//
//  CCDeviceOperationListCell.swift
//  SwiftProject
//
//  Created by Zhang, Joyce on 2024/2/24.
//

import UIKit

class CCDeviceOperationListCell: UITableViewCell {
    
    
    lazy var backView: UIView = {
        let imageView = UIView()
        imageView.backgroundColor = UIColor(hexString: "#383739")
        imageView.layer.cornerRadius = 12
        imageView.clipsToBounds = true
        
        return imageView
    }()
    
    lazy var iconImageView: UIImageView = {
        let imageView = UIImageView()
                imageView.image = UIImage.init(named: "device_vr")
        //        imageView.layer.cornerRadius = KHZSize(40)
        //        imageView.clipsToBounds = true
        //        imageView.layer.borderWidth = KHZSize(2)
        //        imageView.layer.borderColor = UIColor.white.cgColor
        return imageView
    }()
    
    lazy var nameLabel: UILabel = {
        let label = UILabel()
        label.backgroundColor = UIColor.clear
        label.font = KFont_Medium(12)
        label.textColor = KTextColor_White
        label.text = ""
        return label
    }()
    
    lazy var verticalLineView: UIView = {
        let imageView = UIView()
        imageView.backgroundColor = UIColor(hexString: "#515051")
        //        imageView.layer.cornerRadius = 12
        //        imageView.clipsToBounds = true
        
        return imageView
    }()
    
    
    lazy var tipsImageView: UIImageView = {
        let imageView = UIImageView()
        //        imageView.image = UIImage.init(named: "info_step_head_img_default")
        imageView.layer.cornerRadius = 8
        imageView.clipsToBounds = true
        //        imageView.layer.borderWidth = KHZSize(2)
        //        imageView.layer.borderColor = UIColor.white.cgColor
        return imageView
    }()
    
    
    lazy var tipsLabel: UILabel = {
        let label = UILabel()
        label.backgroundColor = UIColor.clear
        label.font = KFont_Regular(14)
        label.textColor = UIColor(hexString: "#B4B4B5")
        label.text = ""
        label.numberOfLines = 0
        return label
    }()
    
    //MARK: - init
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.backgroundColor = .clear
        
        //加载
        self.contentView.addSubview(backView)
        self.backView.addSubview(iconImageView)
        self.backView.addSubview(nameLabel)
        self.backView.addSubview(verticalLineView)
        self.backView.addSubview(tipsImageView)
        self.backView.addSubview(tipsLabel)
        
        //布局
        backView.snp.makeConstraints { (make) in
            make.top.equalTo(self.contentView.snp.top)
            make.leading.equalTo(self.contentView.snp.leading).offset(16)
            make.trailing.equalTo(self.contentView.snp.trailing).offset(-16)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-16)
            
        }
        iconImageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.backView.snp.top).offset(28)
            make.leading.equalTo(self.backView.snp.leading).offset(24)
            make.width.equalTo(48)
            make.height.equalTo(48)
        }
        
        nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.iconImageView.snp.bottom)
            make.centerX.equalTo(self.iconImageView.snp.centerX)
        }
        
        verticalLineView.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.backView.snp.centerY)
            make.leading.equalTo(self.iconImageView.snp.trailing).offset(24)
            make.width.equalTo(1)
            make.height.equalTo(56)
        }
        
        tipsImageView.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.backView.snp.centerY)
            make.leading.equalTo(self.verticalLineView.snp.trailing).offset(24)
            make.width.equalTo(80)
            make.height.equalTo(94)
            
        }
        
        tipsLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.backView.snp.centerY)
            make.leading.equalTo(self.tipsImageView.snp.trailing).offset(16)
            make.trailing.equalTo(self.backView.snp.trailing).offset(-16)
            
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    func setCellData(iconImageName:String,name:String,tipsImageName:String,tips:String) {
        
        iconImageView.image = UIImage.init(named: iconImageName)
        tipsImageView.image = UIImage.init(named: tipsImageName)
        nameLabel.text = name
        tipsLabel.text = tips
        
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}
