//
//  TSEmojisChildColViewModel.swift
//  AIEmoji
//
//  Created by 100Years on 2025/1/19.
//

import ObjectMapper

class TSEmojisChildColViewModel {
    
    
    
}


//MARK: TSEmojisColSectionModel
class TSEmojisColSectionModel: TSBaseModel {
    var name:String = ""
    var items:[TSEmojisColItemModel] = [TSEmojisColItemModel]()
    override func mapping(map: ObjectMapper.Map) {
        name    <- map["name"]
        items   <- map["items"]
    }
}

private let emojisColSection = UIEdgeInsets(top: 24, left: 24, bottom: 24, right: 24)
private let itemW = (k_ScreenWidth - emojisColSection.left - emojisColSection.right - 64 - 1)/3.0
extension TSEmojisColSectionModel : TSCollectionViewSectionComponent{
    var sectionInset: UIEdgeInsets {
        return emojisColSection
    }
    
    var lineSpacing: CGFloat {
        return 32
    }
    
    var itemSpacing: CGFloat {
        return 32
    }
    var headerComponent: TSCollectionViewReuseViewComponent? {
        //暂时没有分区头,但是已经预留有模型了
        return nil
    }
    
    var cells: [TSCollectionViewCellComponent] {
        return items
    }
}



//MARK: TSEmojisColItemModel
class TSEmojisColItemModel: TSBaseModel {
    var dataModel:TSEmojisModel = TSEmojisModel()
    override func mapping(map: ObjectMapper.Map) {
        dataModel    <- map["dataModel"]
    }
}

extension TSEmojisColItemModel: TSCollectionViewCellComponent{
    var cellClass: UICollectionViewCell.Type {
        return TSEmojisCoLItemCell.self
    }
    
    func cellSize(with attrubites: [String : Any]?) -> CGSize {
        return CGSize(width: itemW, height: itemW)
    }
}


////MARK: 分区头
//class TSEmojisColComponentReuseViewModel : TSBaseModel ,CollectionViewReuseViewComponent {
//    var sectionModel:TSGenmojiCoLSectionModel
//
//    init(sectionModel:TSGenmojiCoLSectionModel) {
//        self.sectionModel = sectionModel
//    }
//    
//    required convenience init?(json: [String : Any]) {
//        fatalError("init(json:) has not been implemented")
//    }
//    
//    required convenience init?(map: ObjectMapper.Map) {
//        fatalError("init(map:) has not been implemented")
//    }
//    
//    override func mapping(map: ObjectMapper.Map) {
//        sectionModel    <- map["sectionModel"]
//    }
//    
//    var viewClass: UICollectionReusableView.Type {
//        return TSGenmojiColSectionView.self
//    }
//    
//    var reuseIdentifier: String{
//        return viewClass.description()
//    }
//    
//    var viewSize: CGSize {
//        return sectionModel.style.headerViewSize
//    }
//    
//    var viewType: CollectionViewReuseViewType {
//        return .header
//    }
//}
