jsoncreator_app/JSONCreator_iOS/JSONCreator/MF/ActionBiometricStateModel.swift
Matt Bruce f1bed66dc9 added for project testing
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-10-02 09:37:08 -05:00

57 lines
2.5 KiB
Swift

//
// ActionSetupBiometricsModel.swift
// MobileFirstFramework
//
// Created by Scott Pfeil on 4/5/23.
// Copyright © 2023 Verizon Wireless. All rights reserved.
//
import MVMCore
import MVMCoreUI
public struct ActionBiometricStateModel: ActionModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "biometricState"
public var actionType: String = ActionBiometricStateModel.identifier
public var biometricsEnabledAction: ActionModelProtocol
public var biometricsDisabledAction: ActionModelProtocol?
public var biometricsDeniedAction: ActionModelProtocol?
public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary?
//--------------------------------------------------
// MARK: - Codable
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case actionType
case biometricsEnabledAction
case biometricsDisabledAction
case biometricsDeniedAction
case extraParameters
case analyticsData
}
public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
biometricsEnabledAction = try typeContainer.decodeModel(codingKey: .biometricsEnabledAction)
biometricsDisabledAction = try typeContainer.decodeModelIfPresent(codingKey: .biometricsDisabledAction)
biometricsDeniedAction = try typeContainer.decodeModelIfPresent(codingKey: .biometricsDeniedAction)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(actionType, forKey: .actionType)
try container.encodeModel(biometricsEnabledAction, forKey: .biometricsEnabledAction)
try container.encodeModelIfPresent(biometricsDisabledAction, forKey: .biometricsDisabledAction)
try container.encodeModelIfPresent(biometricsDeniedAction, forKey: .biometricsDeniedAction)
try container.encodeIfPresent(extraParameters, forKey: .extraParameters)
try container.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}