//
//  TSAIDataModel.swift
//  KittensTravelNotes
//
//  Created by 100Years on 2025/7/5.
//

//MARK: 枚举
enum TSAIDataItemAnimationStyle:CaseIterable {
    case none
    case comparison
    case gif
}

let kAIDataSection:UIEdgeInsets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)

//顶部按钮功能
let bannerCardW = k_ScreenWidth - kAIDataSection.left - kAIDataSection.right
let bannerSize:CGSize = CGSize(width: bannerCardW, height: kGetScaleHeight(originalSize: CGSize(width: 343, height: 130), width: bannerCardW))

enum TSAIDataViewStyle:CaseIterable {
    case banner  //Banner
    case styleMore  //更多风格
 
    var itemSize:CGSize {
        switch self {
        case .styleMore:
            return CGSize(width: k_ScreenWidth, height: 236)
        case .banner:
            return CGSize(width: bannerCardW, height: 130)
        }
    }
    
    var cell:TSPlogBaseCell.Type {
        switch self {
        case .banner:
            return TSPlogBannerCell.self
        case .styleMore:
            return TSPlogMoreCell.self
        }
    }
}
//MARK: UI model
class TSAIDataBaseItemVM {
    var title:String = ""
    var imageNamed:String = ""
    var imageURLString:String = ""
    var info:String = ""

    init(title: String, imageNamed: String = "",imageURLString:String = "" , info: String = "") {
        self.title = title
        self.imageURLString = imageURLString
        self.imageNamed = imageNamed
        self.info = info
    }
}

class TSAIDataAnimationItemVM:TSAIDataBaseItemVM{
    var style:TSAIDataItemAnimationStyle = .none
    var imageNameds:[String] = []
    
    init(title: String, info: String = "",style: TSAIDataItemAnimationStyle = .comparison, imageNameds: [String]) {
        self.style = style
        self.imageNameds = imageNameds
        super.init(title: title, imageNamed: "")
    }
}
//MARK: 分区

let kAIDataSectionH = 56.0

class TSAIDataSectionModel {
    var title:String = ""
    var style:TSAIDataViewStyle = .styleMore
    var items:[Any] = []
    var sectionEdge:UIEdgeInsets = UIEdgeInsets(top: 10, left: kAIDataSection.left, bottom: 0, right: kAIDataSection.right)
    var index:Int = 0
    func setTitle(title:String) {
        self.title = title
    }
}


class TSAIDataItemModel {
    var style:TSGeneratorStyle = .ptp
    var viewModel:TSAIDataBaseItemVM
    var generateModel:TSGenerateModel?
    
    var name:String {
        if viewModel.title.isEmpty {
            if let generateModel = generateModel,!generateModel.imageText.isEmpty{
                return generateModel.imageText.localized
            }
        }
        return viewModel.title.localized
    }
    
    var imageNamed:String {
        if !viewModel.imageNamed.isEmpty {
            return viewModel.imageNamed
        }
        return ""
    }
    
    init(style: TSGeneratorStyle,
         viewModel:TSAIDataBaseItemVM,
         generateModel: TSGenerateModel? = nil) {
        self.style = style
        self.viewModel = viewModel
        self.generateModel = generateModel
    }
}
