//
//  BlogsCell.swift
//  WOKA
//
//  Created by MacBook Pro on 10/06/24.
//

import UIKit

class BlogsCell: UICollectionViewCell {

    @IBOutlet weak var blogImage: UIImageView!
    @IBOutlet weak var blogTitle: UILabel!
    @IBOutlet weak var outerView: UIView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        outerView.roundCorner(radius: 10)
        // Initialization code
    }

    func setData(data : BlogDM.Blog){
        if let url = data.thumbnailPath{
            self.blogImage.imageURL(url)
        }else{
            self.blogImage.image = UIImage(named: "Placeholder")
        }
        
        if AuthFunc.shareInstance.getDefaultLanguage() == .english{ // 1 enlgish , 2 hindi
            guard let languageData = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first else{return}
            self.blogTitle.text = languageData.title
            
        }else{
            guard let languageData = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first else{return}
            self.blogTitle.text = languageData.title
        }
//        self.blogTitle.text = data.title
    }
}
