//
//  Untitled.swift
//  LotteryTracker
//
//  Created by aaa on 2026/1/22.
//

import Foundation

class Formatters {
    // 日期格式化器
    static let dateFormatter: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateStyle = .medium
        formatter.timeStyle = .none
        formatter.locale = Locale(identifier: "zh_CN")
        return formatter
    }()
    
    // 货币格式化器
    static let currencyFormatter: NumberFormatter = {
        let formatter = NumberFormatter()
        formatter.numberStyle = .currency
        formatter.locale = Locale(identifier: "zh_CN")
        formatter.currencySymbol = "¥"
        return formatter
    }()
    
    // 格式化金额
    static func formatCurrency(_ amount: Float) -> String {
        currencyFormatter.string(from: NSNumber(value: amount)) ?? "¥0.00"
    }
    
    // 格式化日期
    static func formatDate(_ date: Date) -> String {
        dateFormatter.string(from: date)
    }
    
    // 计算天数差
    static func daysBetween(_ from: Date, _ to: Date) -> Int {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.day], from: from, to: to)
        return components.day ?? 0
    }
    
    // 格式化双色球
    static func formatDoubleColorBall(_ Numbers: String) -> [Int] {
        return []
    }
}
