//
//  SeasonCategoryCell.swift
//  WOKA
//
//  Created by MacBook Pro on 20/06/24.
//

import UIKit

class SeasonCategoryCell: UICollectionViewCell {

    @IBOutlet weak var categoryTitle: UILabel!
    @IBOutlet weak var outerView: UIView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func layoutSubviews() {
        outerView.roundCorner(radius: 25)
    }
    
    func setData(title : String , iselected : Bool){
        self.categoryTitle.text = title
        selectDeselect(isSelected: iselected)
    }
    
    func setSubCategory(data : ShopSubCategoryDM.ResultData, isSelected : Bool){
        self.categoryTitle.text = data.subCategoryName
        selectDeselectsubCategory(isSelected: isSelected)
    }
    
    func selectDeselect(isSelected : Bool){
        if isSelected{
            outerView.backgroundColor = #colorLiteral(red: 0.4495816827, green: 0.2344398499, blue: 0.8120074868, alpha: 1)
            categoryTitle.textColor = .white
        }else{
            outerView.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
            categoryTitle.textColor = .black
        }
    }
    
    func selectDeselectsubCategory(isSelected : Bool){
        if isSelected{
            outerView.backgroundColor = #colorLiteral(red: 0.03529411765, green: 0, blue: 0.3647058824, alpha: 1)
            categoryTitle.textColor = .white
        }else{
            outerView.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
            categoryTitle.textColor = .black
        }
    }
}
