//
//  ShopProductsCell.swift
//  WOKA
//
//  Created by MacBook Pro on 22/07/24.
//

import UIKit

class ShopProductsCell: UICollectionViewCell {

    @IBOutlet weak var productImage: UIImageView!
    @IBOutlet weak var productTitle: UILabel!
    @IBOutlet weak var productPrice: UILabel!
    @IBOutlet weak var outerView: UIView!
    
    override func prepareForReuse() {
        super.prepareForReuse()
        // Reset or reapply shadow only if needed
        outerView.layer.shadowPath = nil
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        productTitle.font = FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 13)
        productPrice.font = FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 13)
        outerView.addShadowAndCorner(radius: 6, shadowColor: .darkGray, shadowOpacity: 0.5, shadowOffset: CGSize(width: 0, height: 0.3), shadowRadius: 3)
    }
    
    func setData(data : ShopProductsListingDM.ResultData){
        if data.subCategoryMasterID == 12{
            self.productTitle.text = data.shopMasterDetail?.productNameEnglish
        }else{
            self.productTitle.text = data.shopMasterDetail?.productNameHindi
        }
//        self.productTitle.text = data.productName
        self.productPrice.text = data.productPrice
        
        if let url = data.shopImage?.first{
            self.productImage.imageURL(url, color: .black)
        }
    }

}
