import UIKit

/// people table view cell
class OsobyTableViewCell: UITableViewCell {

    static let reuseString = "OsobyTableViewCellIdentifier"
    
    public let title: UILabel = {
        let view = UILabel()
        view.translatesAutoresizingMaskIntoConstraints = false
        view.textColor = scoutBlue
        return view
    }()
    
    public let phoneTitle: UILabel = {
        let view = UILabel()
        view.translatesAutoresizingMaskIntoConstraints = false
        view.textColor = scoutOrange
        return view
    }()
    
    public let emailTitle: UILabel = {
        let view = UILabel()
        view.translatesAutoresizingMaskIntoConstraints = false
        view.textColor = scoutOrange
        return view
    }()
    
    /// initialize function
    /// - Parameters:
    ///   - style: style for cell
    ///   - reuseIdentifier: reuse indetifier for cell
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = .white
        addSubview(title)
        addSubview(phoneTitle)
        addSubview(emailTitle)
        setupConstraints()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /// setup function view view constraints
    private func setupConstraints() {
        NSLayoutConstraint.activate([
            title.topAnchor.constraint(equalTo: topAnchor, constant: 8),
            title.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 12),
            title.trailingAnchor.constraint(equalTo: trailingAnchor),
            
            phoneTitle.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 8),
            phoneTitle.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 12),
            phoneTitle.trailingAnchor.constraint(equalTo: trailingAnchor),
            
            emailTitle.topAnchor.constraint(equalTo: phoneTitle.bottomAnchor, constant: 8),
            emailTitle.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 12),
            emailTitle.trailingAnchor.constraint(equalTo: trailingAnchor),
            emailTitle.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -8)
        ])
    }
}
