import Foundation

enum ThemeOption: String, CaseIterable, Identifiable {
    case system
    case oledDark
    case lightTest
    case dark
    case custom

    var id: String { rawValue }

    var title: String {
        switch self {
        case .system:
            return NSLocalizedString("Системная", comment: "")
        case .oledDark:
            return NSLocalizedString("OLEG тёмный", comment: "")
        case .dark:
            return NSLocalizedString("Тёмная", comment: "")
        case .lightTest:
            return NSLocalizedString("Светлая", comment: "")
        case .custom:
            return NSLocalizedString("Кастомная", comment: "")
        }
    }

    var note: String? {
        switch self {
        case .lightTest:
            return NSLocalizedString("Тестовая версия", comment: "")
        case .dark, .custom:
            return NSLocalizedString("Недоступна", comment: "")
        default:
            return nil
        }
    }

    var isEnabled: Bool {
        switch self {
        case .dark, .custom:
            return false
        default:
            return true
        }
    }

    var mappedTheme: Theme? {
        switch self {
        case .system:
            return .system
        case .oledDark:
            return .oledDark
        case .lightTest:
            return .light
        case .dark, .custom:
            return nil
        }
    }

    static var ordered: [ThemeOption] {
        [.system, .oledDark, .lightTest, .dark, .custom]
    }

    static func option(for theme: Theme) -> ThemeOption {
        switch theme {
        case .system:
            return .system
        case .light:
            return .lightTest
        case .oledDark:
            return .oledDark
        }
    }
}
