// // StackPageTemplate.swift // MVMCoreUI // // Created by Suresh, Kamlesh on 11/22/19. // Copyright © 2019 Verizon Wireless. All rights reserved. // import Foundation @objcMembers public class StackPageTemplateModel: TemplateModelProtocol { public var formRules: [FormGroupRule]? public var formValidator: FormValidator? public static var identifier: String = "stack" public var pageType: String public var screenHeading: String? public var isAtomicTabs: Bool? public var header: MoleculeModelProtocol? public var moleculeStack: MoleculeStackModel public var footer: MoleculeModelProtocol? public init(pageType: String, moleculeStack: MoleculeStackModel) { self.pageType = pageType self.moleculeStack = moleculeStack } private enum CodingKeys: String, CodingKey { case pageType case template case screenHeading case header case footer case stack case isAtomicTabs case formRules } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) pageType = try typeContainer.decode(String.self, forKey: .pageType) moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) header = try typeContainer.decodeModelIfPresent(codingKey: .header) footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(pageType, forKey: .pageType) try container.encode(template, forKey: .template) try container.encode(moleculeStack, forKey: .stack) try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs) try container.encodeModelIfPresent(header, forKey: .header) try container.encodeModelIfPresent(footer, forKey: .footer) try container.encodeIfPresent(formRules, forKey: .formRules) } }