// // ActionRegisterFidoModel.swift // MobileFirstFramework // // Created by Scott Pfeil on 6/12/23. // Copyright © 2023 Verizon Wireless. All rights reserved. // import Foundation import MVMCore public struct ActionRegisterFidoModel: ActionModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- public static var identifier: String = "registerFIDO" public var actionType: String = ActionRegisterFidoModel.identifier public var accessToken: String public var fidoGuid: String public var userIdentifier: String public var fidoRegistrationError: String public var onSuccess: ActionModelProtocol public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? //-------------------------------------------------- // MARK: - Codable //-------------------------------------------------- private enum CodingKeys: String, CodingKey { case actionType case accessToken case fidoGuid case userIdentifier case fidoRegistrationError case onSuccess case extraParameters case analyticsData } public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) accessToken = try typeContainer.decode(String.self, forKey: .accessToken) fidoGuid = try typeContainer.decode(String.self, forKey: .fidoGuid) userIdentifier = try typeContainer.decode(String.self, forKey: .userIdentifier) fidoRegistrationError = try typeContainer.decode(String.self, forKey: .fidoRegistrationError) onSuccess = try typeContainer.decodeModel(codingKey: .onSuccess) 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.encode(accessToken, forKey: .accessToken) try container.encode(fidoGuid, forKey: .fidoGuid) try container.encode(userIdentifier, forKey: .userIdentifier) try container.encode(fidoRegistrationError, forKey: .fidoRegistrationError) try container.encodeModel(onSuccess, forKey: .onSuccess) try container.encodeIfPresent(extraParameters, forKey: .extraParameters) try container.encodeIfPresent(analyticsData, forKey: .analyticsData) } }