//
//  RuleAnyModel.swift
//  MVMCoreUI
//
//  Created by Suresh, Kamlesh on 2/24/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

import Foundation

public class RuleAnyValueChangedModel: RuleAnyModelProtocol {
    //--------------------------------------------------
    // MARK: - Properties
    //--------------------------------------------------
    
    public static var identifier: String = "anyValueChanged"
    public var type: String = RuleAnyValueChangedModel.identifier
    public var ruleId: String? 
    public var errorMessage: [String: String]?
    public var fields: [String]

    //--------------------------------------------------
    // MARK: - Initializer
    //--------------------------------------------------

    public init(fields: [String]) {
        self.fields = fields
    }

    //--------------------------------------------------
    // MARK: - Validation
    //--------------------------------------------------
    
    public func isValid(_ formField: FormFieldProtocol) -> Bool {
        return formField.baseValue != formField.formFieldValue()
    }
}
