import Foundation
import UIKit

/// profile view controller 
class ProfileViewController: UIViewController {
    private let button: UIButton = {
        let button = UIButton()
        button.setTitle("Odhlasit", for: .normal)
        button.setTitleColor(.black, for: .normal)
        button.showsTouchWhenHighlighted = true
        button.backgroundColor = scoutBlue
        button.layer.cornerRadius = 10
        button.translatesAutoresizingMaskIntoConstraints = false
        return button
    }()
    
    /// initialization function
    init() {
        super.init(nibName: nil, bundle: nil)
        view.addSubview(button)
        button.addTarget(self, action: #selector(tap), for: .touchUpInside)
        button.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
        button.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /// function that calls for logout after user taps on button
    @objc private func tap() {
        Auth.shared.logOut()
    }
}
