//
//  CallAlertVC.swift
//  WoWonder
//
//  Created by iMac on 10/10/23.
//  Copyright © 2023 ScriptSun. All rights reserved.
//

import UIKit

protocol CallAlertVCDelegate {
    func handleCallAlertOptionTap(callLog: CallLogModel, call_Type: String)
}

class CallAlertVC: UIViewController {
    
    // MARK: - Properties
    
    var callLog = CallLogModel()
    var delegate: CallAlertVCDelegate?
    
    // MARK: - View Life Cycles

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        self.initialConfig()
    }
    
    //MARK: - Selectors
    
    // Voice Call Button Action
    @IBAction func voiceCallButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleCallAlertOptionTap(callLog: self.callLog, call_Type: "audio")
        }
    }
    
    // Video Call Button Action
    @IBAction func videoCallButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleCallAlertOptionTap(callLog: self.callLog, call_Type: "video")
        }
    }
    
    // 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)
    }

}
