import Foundation
import AVKit

enum VideoQuality: String {
    case original
    case high
    case medium
    case low

    static var current: VideoQuality? {
        guard let v = Settings.videoQuality.string() else {
            return nil
        }
        return VideoQuality(rawValue: v)
    }

    var preset: String {
        switch self {
        case .original:
            return AVAssetExportPresetPassthrough

        case .high:
            return AVAssetExportPresetHighestQuality

        case .medium:
            return AVAssetExportPresetMediumQuality

        case .low:
            return AVAssetExportPresetLowQuality
        }
    }

    var localized: String {
        switch self {
        case .original:
            return NSLocalizedString("Original", comment: "Image or Video Quality")

        case .high:
            return NSLocalizedString("High", comment: "Image or Video Quality")

        case .medium:
            return NSLocalizedString("Medium", comment: "Image or Video Quality")

        case .low:
            return NSLocalizedString("Low", comment: "Image or Video Quality")
        }
    }
}
