import Foundation

final class LocalizedPostSettings: ObservableObject {

    @Published
    var title: String

    @Published
    var description: String

    @Published
    var feedUrlPrefix: String

    init(title: String, description: String, feedUrlPrefix: String) {
        self.title = title
        self.description = description
        self.feedUrlPrefix = feedUrlPrefix
    }

    // MARK: Storage

    init(file: LocalizedPostSettingsFile) {
        self.title = file.feedTitle
        self.description = file.feedDescription
        self.feedUrlPrefix = file.feedUrlPrefix
    }

    var file: LocalizedPostSettingsFile {
        .init(
            feedTitle: title,
            feedDescription: description,
            feedUrlPrefix: feedUrlPrefix)
    }
}
