//
//  TSEmojisCoLItemCell.swift
//  AIEmoji
//
//  Created by 100Years on 2025/1/20.
//

class TSEmojisCoLItemCell: TSBaseCollectionCell {
    
    lazy var showImageView: UIImageView = {
        let showImageView = UIImageView.createImageView(imageName:"")
        showImageView.backgroundColor = .gray
        showImageView.layer.cornerRadius = 18
        return showImageView
    }()
    
    lazy var vipImageView: UIImageView = {
        let vipImageView = UIImageView.createImageView(imageName:"vip_side_icon")
        vipImageView.contentMode = .scaleToFill
        return vipImageView
    }()
    
    override func creatUI() {
        bgContentView.cornerRadius = 18
        bgContentView.addSubview(showImageView)
        showImageView.snp.makeConstraints { make in
            make.top.equalTo(0)
            make.leading.equalTo(0)
            make.trailing.bottom.equalTo(0)
        }
        
        bgContentView.addSubview(vipImageView)
        vipImageView.snp.makeConstraints { make in
            make.width.height.equalTo(40)
            make.top.equalTo(-8)
            make.trailing.equalTo(8)
        }
    }
    
    
    
    override func renderView(with object: Any?, component: TSCollectionViewComponent, attributes: [String : Any]?) {
        super.renderView(with: object, component: component, attributes: attributes)
        if let itemModel = object as? TSEmojisColItemModel{
            showImageView.setAsyncImage(urlString: itemModel.dataModel.imageUrl,placeholder: kPlaceholderImage)
            vipImageView.isHidden = !itemModel.dataModel.vip
        }
    }

    
}
