//
//  ReplaceAudioAlertVC.swift
//  WoWonder
//
//  Created by iMac on 20/05/25.
//  Copyright © 2025 ScriptSun. All rights reserved.
//

import UIKit

protocol ReplaceAudioAlertVCDelegate {
    func handleReplaceAudioOptionTap(replace_audio: String)
}

class ReplaceAudioAlertVC: UIViewController {
    
    // MARK: - Properties
    
    var delegate: ReplaceAudioAlertVCDelegate?
    
    // MARK: - View Life Cycles
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
        
        self.initialConfig()
    }
    
    //MARK: - Selectors
    
    // No Button Action
    @IBAction func noButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleReplaceAudioOptionTap(replace_audio: "No")
        }
    }
    
    // Remove Button Action
    @IBAction func removeButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleReplaceAudioOptionTap(replace_audio: "Remove")
        }
    }
    
    // Chose Source Button Action
    @IBAction func chooseSourceButtonAction(_ sender: UIButton) {
        self.view.endEditing(true)
        self.dismiss(animated: true) {
            self.delegate?.handleReplaceAudioOptionTap(replace_audio: "Choose source")
        }
    }
    
    // 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)
    }
    
}
