//
//  YHAddIncomeRecordCell.swift
//  galaxy
//
//  Created by alexzzw on 2024/11/13.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit

class YHAddIncomeRecordCell: YHResignDocumentCell {
    static let cellReuseIdentifier = "YHAddIncomeRecordCell"
    var addButtonClickEvent: (() -> Void)?

    private lazy var addItemView: YHWorkItemAddView = {
        let view = YHWorkItemAddView()
        view.addBtn.setTitle("新增收入信息".local, for: .normal)
        view.addBtn.setImage(UIImage(named: "income_item_add"), for: .normal)
        view.clickBlock = { [weak self] in
            guard let self = self else { return }
            self.addButtonClickEvent?()
        }
        return view
    }()

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }

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

extension YHAddIncomeRecordCell {
    private func setupUI() {
        updateCellCorner(.bottom)
        subContainerView.addSubview(addItemView)
        addItemView.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(16)
            make.bottom.equalToSuperview().offset(-16)
            make.left.equalToSuperview().offset(18)
            make.right.equalToSuperview().offset(-18)
            make.height.equalTo(44)
        }
    }
}
