//
//  MPPositive_HomeListFourthCollectionViewCell.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/4/22.
//

import UIKit
///b面首页展示列表四（歌手）
class MPPositive_HomeListFourthCollectionViewCell: UICollectionViewCell {
    //歌手图片
    private lazy var singerImageView:UIImageView = {
        let imageView:UIImageView = .init()
        imageView.contentMode = .scaleAspectFill
        imageView.layer.masksToBounds = true
        imageView.layer.cornerRadius = 32*width
        return imageView
    }()
    //歌手名字
    private lazy var singerLabel:UILabel = createLabel("Name", font: .systemFont(ofSize: 12, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.8), textAlignment: .left)
    var itemViewModel:MPPositive_BrowseItemViewModel!{
        didSet{
            itemViewModel.setUrltoImage(singerImageView)
            singerLabel.text = itemViewModel.title
//            subtitleLabel.text = itemViewModel.subtitle
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        confirgue()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    //配置
    private func confirgue() {
        backgroundColor = .clear
        layer.masksToBounds = true
        addSubview(singerImageView)
        singerImageView.snp.makeConstraints { make in
            make.width.height.equalTo(64*width)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview()
        }
        addSubview(singerLabel)
        singerLabel.snp.makeConstraints { make in
            make.centerX.bottom.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(0.7)
        }
    }
}
