//
//  SwitchTVC.swift
//  MyTatvaCare
//
//  Created by Nirav Ramani on 07/05/25.
//

import UIKit

class SwitchTVC: UITableViewCell {

    @IBOutlet weak var labelTurnOn: UILabel!
    @IBOutlet weak var labelTrouble: UILabel!
    @IBOutlet weak var viewTrouble: UIView!
    @IBOutlet weak var buttonTrouble: UIButton!
    @IBOutlet weak var switchUI: UISwitch!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        labelTurnOn.font = FontManager.font(ofSize: 16, weight: .medium)
        labelTurnOn.textColor = CustomColor.shared.indigo
        switchUI.onTintColor =  CustomColor.shared.lightGreen
        setTroubleText()
    }

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

        // Configure the view for the selected state
    }
    
    func setTroubleText() {
        let first = "Having trouble with bluetooth permissions? "
        let second = "Know More"

        let attributedString = NSMutableAttributedString(string: first, attributes: [
            .font: FontManager.font(ofSize: 12, weight: .regular),
            .foregroundColor: CustomColor.shared.gray
        ])

        let secondAttributes: [NSAttributedString.Key: Any] = [
            .foregroundColor: CustomColor.shared.lightGreen,
            .underlineStyle: NSUnderlineStyle.single.rawValue,
            .font:  FontManager.font(ofSize: 12, weight: .semibold)
        ]

        let secondPart = NSAttributedString(string: second, attributes: secondAttributes)
        attributedString.append(secondPart)
        labelTrouble.attributedText = attributedString
    }
}
