//
//  LinkedChildCell.swift
//  WOKA
//
//  Created by MacBook Pro on 09/05/24.
//

import UIKit

class LinkedChildCell: UITableViewCell {

    @IBOutlet weak var outerView: UIView!
    @IBOutlet weak var childAvatarImage: UIImageView!
    @IBOutlet weak var childName: UILabel!
    @IBOutlet weak var imageSupportView: UIView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        outerView.roundCorner(radius: 15)
        imageSupportView.roundCorner()
        outerView.backgroundColor = .white.withAlphaComponent(0.5)
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func setData(data : LinkedChildDM.ResultChild){
        if let imageAvatar = data.avtar{
            self.childAvatarImage.imageURL(imageAvatar)
        }
        self.childName.text = data.username
    }
    
    func setLinkedData(data : UserNameDM){
        self.childName.text = data.username
        self.childAvatarImage.image = UIImage(named: "DefaultAvatar")
    }
}
