//
//  RelationshipAlertVC.swift
//  WoWonder
//
//  Created by UnikApp on 17/12/22.
//  Copyright © 2022 ScriptSun. All rights reserved.
//

import UIKit

protocol RelationshipAlertVCDelegate {
    func handleRelationshipTap(relationship_id: String, relationship: String)
}

class RelationshipAlertVC: UIViewController {
    
    // MARK: - Properties
    
    var delegate: RelationshipAlertVCDelegate?
    
    // MARK: - View Life Cycles
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        self.initialConfig()
    }
    
    // MARK: - Selectors

    // None Button Action
    @IBAction func noneButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleRelationshipTap(relationship_id: "0", relationship: "None")
        }
    }
    
    // Single Button Action
    @IBAction func singleButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleRelationshipTap(relationship_id: "1", relationship: "Single")
        }
    }

    // In A Relationship Button Action
    @IBAction func inAReationshipButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleRelationshipTap(relationship_id: "2", relationship: "In a relationship")
        }
    }

    // Married Button Action
    @IBAction func marriedButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleRelationshipTap(relationship_id: "3", relationship: "Married")
        }
    }

    // Engaged Button Action
    @IBAction func engagedButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleRelationshipTap(relationship_id: "4", relationship: "Engaged")
        }
    }
    
    // Close Button Action
    @IBAction func closeButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true)
    }
    
    // MARK: - Helper Functions
    
    // Initial Config
    func initialConfig() {
        self.view.backgroundColor = .black.withAlphaComponent(0.4)
    }

}
