import Foundation

final class ToolSettings: ObservableObject {

    /// The items to show in the navigation bar
    @Published
    var ffprobePath: String

    @Published
    var avifencPath: String

    init(ffprobePath: String,
         avifencPath: String) {
        self.ffprobePath = ffprobePath
        self.avifencPath = avifencPath
    }
}

// MARK: Storage

extension ToolSettings {

    convenience init(context: LoadingContext, data: ToolSettings.Data) {
        self.init(
            ffprobePath: data.ffprobePath,
            avifencPath: data.avifencPath)
    }

    struct Data: Codable, Equatable {
        let ffprobePath: String
        let avifencPath: String
    }

    var data: Data {
        .init(
            ffprobePath: ffprobePath,
            avifencPath: avifencPath)
    }
}
