//
//  TSAIRintoneVM.swift
//  AIRingtone
//
//  Created by 100Years on 2025/3/6.
//

class TSAIRintoneVM {
    lazy var aiRintoneHistoryModel: TSAIRintoneHistoryModel = {
        let model = TSAIRintoneHistoryModel(title: "Generate History", list:TSAIRintoneHistory.listModelArray)
        return model
    }()
    
    lazy var historyModelList: [TSAIRintoneHistoryModel] = {
        gethistoryModelList()
    }()
    
    private func gethistoryModelList()->[TSAIRintoneHistoryModel]{
        if aiRintoneHistoryModel.list.count > 0 {
            return [aiRintoneHistoryModel]
        }
        return []
    }
    
    func updateRecentData() {
        aiRintoneHistoryModel.list = TSAIRintoneHistory.listModelArray
        historyModelList = gethistoryModelList()
    }
    
    func removeModel(model:TSActionInfoModel){
        TSAIRintoneHistory.removeModel(model: model)
        updateRecentData()
    }
}


class TSAIRintoneHistoryModel {
    var title:String = ""
    var list:[TSActionInfoModel] = []
    
    init(title: String, list: [TSActionInfoModel]) {
        self.title = title
        self.list = list
    }
}
