//
//  PQStuckPointSearchEmptyCell.swift
//  PQSpeed
//
//  Created by SanW on 2021/5/7.
//  Copyright © 2021 BytesFlow. All rights reserved.
//

import UIKit
import BFCommonKit

class PQStuckPointSearchEmptyCell: UICollectionViewCell {
    lazy var emptyImageView: UIImageView = {
        let emptyImageView = UIImageView(image:UIImage.moduleImage(named: "pic_search_empty", moduleName: "BFFramework",isAssets: false))
        emptyImageView.backgroundColor = UIColor.clear
        emptyImageView.contentMode = .scaleAspectFit
        return emptyImageView
    }()

    lazy var remindLab: UILabel = {
        let remindLab = UILabel()
        remindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
        remindLab.text = "没有搜索到相关音乐"
        remindLab.font = UIFont.systemFont(ofSize: 14)
        remindLab.numberOfLines = 1
        remindLab.textAlignment = NSTextAlignment.center
        return remindLab
    }()

    lazy var hotRemindLab: UILabel = {
        let hotRemindLab = UILabel()
        hotRemindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
        hotRemindLab.text = "试试热门音乐"
        hotRemindLab.font = UIFont.systemFont(ofSize: 15)
        hotRemindLab.numberOfLines = 1
        hotRemindLab.textAlignment = NSTextAlignment.center
        return hotRemindLab
    }()

    lazy var leftLineView: UIView = {
        let leftLineView = UIView()
        leftLineView.backgroundColor = UIColor.hexColor(hexadecimal: "#515151")
        return leftLineView
    }()

    lazy var rightLineView: UIView = {
        let rightLineView = UIView()
        rightLineView.backgroundColor = UIColor.hexColor(hexadecimal: "#515151")
        return rightLineView
    }()

    @objc class func stuckPointSearchEmptyCell(collectionView: UICollectionView, indexPath: IndexPath) -> PQStuckPointSearchEmptyCell {
        let cell: PQStuckPointSearchEmptyCell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: PQStuckPointSearchEmptyCell.self), for: indexPath) as! PQStuckPointSearchEmptyCell
        return cell
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(emptyImageView)
        contentView.addSubview(remindLab)
        contentView.addSubview(leftLineView)
        contentView.addSubview(hotRemindLab)
        contentView.addSubview(rightLineView)
    }

    required init?(coder _: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    var bgmData: PQEmptyModel? {
        didSet {
            addData()
            addLayout()
        }
    }

    func addData() {}

    func addLayout() {
        let margin: CGFloat = 24
        let leftMargin: CGFloat = 16
        let imageW: CGFloat = 109
        let imageH: CGFloat = 69
        emptyImageView.snp.makeConstraints { make in
            make.width.equalTo(imageW)
            make.height.equalTo(imageH)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(imageH)
        }
        remindLab.snp.makeConstraints { make in
            make.top.equalTo(emptyImageView.snp.bottom).offset(margin)
            make.centerX.equalToSuperview()
        }
        hotRemindLab.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.width.equalTo(imageW)
            make.bottom.equalToSuperview().offset(-margin)
        }
        leftLineView.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(leftMargin)
            make.height.equalTo(1)
            make.centerY.equalTo(hotRemindLab)
            make.right.equalTo(hotRemindLab.snp.left).offset(-leftMargin)
        }
        rightLineView.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-leftMargin)
            make.height.equalTo(1)
            make.centerY.equalTo(hotRemindLab)
            make.left.equalTo(hotRemindLab.snp.right).offset(leftMargin)
        }
    }

    @objc func btnClick(sender _: UIButton) {}
}
