//
//  AlertObject.swift
//  MVMCore
//
//  Created by Suresh, Kamlesh on 7/10/20.
//  Copyright © 2020 myverizon. All rights reserved.
//

import MVMCore

public protocol AlertModelProtocol {
    var title: String? { get }
    var message: String? { get }
    var actions: [UIAlertAction] { get }
    var preferredActionIndex: Int? { get }
    var preferredStyle: UIAlertController.Style { get }
}

/// An object with properties for managing the alert.
public struct AlertObject {
    
    /// Greedy alerts dismiss any other alerts and do not allow any other alerts to show until finished.
    public var isGreedy = false
    
    /// The alert model for the alert to show.
    public var alertModel: AlertModelProtocol
    
    public weak var alertDelegate: AlertDelegateProtocol?
    
    public init(alertModel: AlertModelProtocol, isGreedy: Bool = false, alertDelegate: AlertDelegateProtocol? = nil) {
        self.alertModel = alertModel
        self.isGreedy = isGreedy
        self.alertDelegate = alertDelegate
    }
}
