//
//  Cell_FinishOrderItemSelect.swift
//  VattiCSS
//
//  Created by Jan on 2024/1/18.
//

import UIKit

class Cell_FinishOrderItemSelect: UITableViewCell {
    @IBOutlet weak var bgView: UIView!
    @IBOutlet weak var btn_icon: UIButton!
    @IBOutlet weak var lab_name: UILabel!
    @IBOutlet weak var lab_code: UILabel!
    @IBOutlet weak var btn_state: UIButton!
    
    var callBack: TCRowCallBack?
    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
    }
    
    
    @IBAction func seleteAtion(_ sender: UIButton) {
        callBack?("")
    }
    
    
    @IBAction func seleteAction(_ sender: UIButton) {
        callBack?("")
    }
    
}


extension Cell_FinishOrderItemSelect: TCCell_RowCellUpdateProtocol {

    typealias DataSource = (String,String,String,Bool)
    typealias ConfigModel = TCFormCellConfigModel
    
    func row_update(config data: TCFormCellConfigModel) {
      
    }
    
    func row_update(dataSource data: (String,String,String,Bool)) {
        lab_name.text = data.0
        lab_code.text = data.1
        
        if data.2 == ""{
            btn_icon.setImage(UIImage(named: "default_img"), for: .normal)
        }else{
            btn_icon.sd_setImage(with: URL(string: data.2), for: .normal, placeholderImage: UIImage(named: "default_img"), context: nil)
        }
      
        
        let image = UIImage(named: data.3==true ? "hep_radiobox_selected" : "hep_radiobox_normal")
        btn_state.setImage(image, for: .normal)
    }
    
    func row_update(callBack block: TCRowCallBack?) {
        callBack = block
    }
    
}
