//
//  TSConfig.swift
//  TSLiveWallpaper
//
//  Created by 100Years on 2024/12/20.
//
class TSConfig: NSObject {
    static let appLanguage: String = {
        let systemLanguages = UserDefaults.standard.value(forKey: "AppleLanguages")
        var currentLanguage: String?
        if let arr = systemLanguages as? [String] {
            currentLanguage = arr.first
        }
        else if let str = systemLanguages as? String {
            currentLanguage = str
        }
        return currentLanguage ?? ""
    }()
    
    static let appLanguageShort: String? = {
        let currentLanguage = Bundle.main.preferredLocalizations.first
        if let str = currentLanguage?.components(separatedBy: "-").first,
           str.count >= 2 {
            return str
        }
        return nil
    }()
    
    static let isLanguageZh: Bool = {
        if appLanguage.lowercased().hasPrefix("zh") {
            return true
        }
        return false
    }()
    
    static let isLanguageJa: Bool = {
        if appLanguage.lowercased().hasPrefix("ja") {
            return true
        }
        return false
    }()
    
    static var languageSuffix: String {
        if appLanguage.lowercased().hasPrefix("zh") {
            return "-zh"
        }
        return ""
    }
    
    static var isChinaRegion: Bool {
#if DEBUG
        return true
#endif
        let localeId = Locale.current.identifier
        return localeId.contains("_CN")
    }
    
    static let appid = "6447607955" 

}


extension UIColor {
    /// 背景色
    static let mainBg = UIColor.black
    
    /// 主色调
    static let themeColor = UIColor.clear
    
    static let naviMianBgColor = UIColor.clear
    static let naviMianTextColor = UIColor.white.withAlphaComponent(0.8)
    
    static let mainDisable = UIColor(named: "c_main_disable")!
    
    /// 分割线
    static let sepaLine = UIColor(named: "c_sepa_line")!
    
    /// 主要文字
    static let mainText = "#010101".toColor()!
    
    /// 次要文字
    static let lesserText = "#010101".toColor()!
    
    /// 弱文字
    static let textDisable = "#010101".toColor()!
    
    /// 辅助文字
    static let textAssist = "#010101".toColor()!
    
    /// 成功
    static let success = UIColor(named: "c_success")!
    
    /// 辅助色
    static let assist = UIColor(named: "c_assist")!
    
    /// 按钮色
    static let button = UIColor(named: "c_button")!
    
    /// 警示色
    static let alert = UIColor(named: "c_alert")!
    
    /// 主色调
    static let mainGlowing = "#D553FA".toColor()!
    static let mainLightGlowing = "#FE01AA".toColor()!
    
    /// 辅助 - 蓝色
    static let assistBlue = UIColor(named: "c_assist_blue")!
}
