//
//  GenderAlertVC.swift
//  WoWonder
//
//  Created by iMac on 06/09/23.
//  Copyright © 2023 ScriptSun. All rights reserved.
//

import UIKit

protocol GenderAlertVCDelegate {
    func handleGenderTap(gender: String)
}

class GenderAlertVC: UIViewController {
    
    // MARK: - Properties
    
    var delegate: GenderAlertVCDelegate!
    
    // MARK: - View Life Cycles

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        self.initialConfig()
    }
    
    // MARK: - Selectors
    
    // Female Button Action
    @IBAction func femaleButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate.handleGenderTap(gender: "Female")
        }
    }
    
    // Male Button Action
    @IBAction func maleButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate.handleGenderTap(gender: "Male")
        }
    }
    
    // Close Button Action
    @IBAction func closeButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true, completion: nil)
    }
    
    // MARK: - Helper Functions
    
    // Initial Config
    func initialConfig() {
        self.view.backgroundColor = .black.withAlphaComponent(0.4)
    }

}
