//
//  FaqCell.swift
//  WOKA
//
//  Created by MacBook Pro on 03/06/24.
//

import UIKit

class FaqCell: UITableViewCell {

    @IBOutlet weak var question: UILabel!
    @IBOutlet weak var answer: UILabel!
    @IBOutlet weak var expandedimage: UIImageView!
    @IBOutlet weak var lineSeperator: UIView!
    
    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
    }
    
    func setData(data : FaqListDM.ResultData){
        self.question.text = data.englishQuestion
        self.answer.text = data.englishAnswer
        self.answer.isHidden = !data.isExpanded!
        
        if let isExpaned = data.isExpanded , isExpaned{
            self.answer.isHidden = false
            self.expandedimage.image = UIImage(named: "CollapseFaq")
            lineSeperator.isHidden = false
        }else{
            self.answer.isHidden = true
            self.expandedimage.image = UIImage(named: "ExpandFaq")
            lineSeperator.isHidden = true
        }
    }
    
}
