//
//  SpeakEleDailyCell.swift
//  SpeakEasyLearnEnglish
//
//  Created by mac on 2025/7/16.
//

import UIKit

class SpeakEleDailyCell: UITableViewCell {
    
    lazy var backView: UIView = {
       let bView = UIView()
        bView.backgroundColor = .white
        bView.isUserInteractionEnabled = true
       return bView
   }()
    
    lazy var imgView: UIImageView = {
       let bView = UIImageView()
        bView.image = UIImage(named: "sp-progress-Lfire")
       return bView
   }()
    
    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.textColor = .black
        label.font = UIFont.montserrat(.bold ,size: 20)
        label.text = "Cumulative Streak：5"
        return label
    }()
    
    lazy var line: UIView = {
       let lineView = UIView()
        lineView.backgroundColor = UIColor.init(with: "#000000", alpha: 0.12)
       return lineView
   }()
    
    lazy var subTitleLabel: UILabel = {
        let label = UILabel()
        label.textColor = .black
        label.font = UIFont.montserrat(.bold ,size: 20)
        label.text = "Daily learning"
        return label
    }()
    
    lazy var tipLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.init(with: "#000000", alpha: 0.54)
        label.font = UIFont.montserrat(.bold ,size: 14)
        label.text = "Maste more know edge every day"
        return label
    }()
    
    lazy var scView: SpeakElePCView = {
        let layout = UICollectionViewFlowLayout()
        let collectionView = SpeakElePCView(frame: CGRect.zero, collectionViewLayout: layout)
        layout.scrollDirection = .horizontal
        collectionView.backgroundColor = .clear
        return collectionView
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.backgroundColor = .clear
        self.backgroundColor = .clear
        //  创建UI方法
        creatUI()
//        bindViewModel()
    }
    //  这个方法也是必须要实现的，和重写初始化方法在一起实现。
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }
    
    func creatUI() {
        self.contentView.addSubview(backView)
        backView.addSubview(imgView)
        backView.addSubview(titleLabel)
        backView.addSubview(line)
        backView.addSubview(subTitleLabel)
        backView.addSubview(tipLabel)
        backView.addSubview(scView)
        
        backView.snp.makeConstraints { make in
            make.left.equalTo(24)
            make.right.equalTo(-24)
            make.top.equalTo(18)
            make.bottom.equalTo(-24)
            make.height.equalTo(268)
        }
        backView.corners = 16
        
        imgView.snp.makeConstraints { make in
            make.width.height.equalTo(32)
            make.left.equalTo(24)
            make.top.equalTo(16)
        }
        
        titleLabel.snp.makeConstraints { make in
            make.height.equalTo(28)
            make.left.equalTo(imgView.snp.right).offset(8)
            make.centerY.equalTo(imgView)
        }
        
        line.snp.makeConstraints { make in
            make.height.equalTo(0.6)
            make.left.equalTo(16)
            make.right.equalTo(-16)
            make.top.equalTo(titleLabel.snp.bottom).offset(18)
        }
        
        subTitleLabel.snp.makeConstraints { make in
            make.height.equalTo(28)
            make.left.equalTo(imgView.snp.left)
            make.right.equalTo(-24)
            make.top.equalTo(line.snp.bottom).offset(16)
        }
        
        tipLabel.snp.makeConstraints { make in
            make.height.equalTo(20)
            make.left.equalTo(imgView.snp.left)
            make.right.equalTo(-24)
            make.top.equalTo(subTitleLabel.snp.bottom).offset(16)
        }
        
        
        scView.snp.makeConstraints { make in
            make.height.equalTo(100)
            make.left.equalTo(imgView.snp.left)
            make.right.equalTo(-24)
            make.top.equalTo(tipLabel.snp.bottom).offset(14)
        }
    }

}
