//
//  ModalListPageTemplateModel.swift
//  MVMCoreUI
//
//  Created by Subramaniam, Ramya on 15/07/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//


@objcMembers open class ModalListPageTemplateModel: ListPageTemplateModel {
    //--------------------------------------------------
    // MARK: - Properties
    //--------------------------------------------------
    
    open override class var identifier: String { "modalList" }
    
    public var closeAction: ActionModelProtocol?
    
    //--------------------------------------------------
    // MARK: - Keys
    //--------------------------------------------------
    
    private enum CodingKeys: String, CodingKey {
        case closeAction
    }
    
    //--------------------------------------------------
    // MARK: - Codec
    //--------------------------------------------------
    
    required public init(from decoder: Decoder) throws {
        let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
        closeAction = try typeContainer.decodeModelIfPresent(codingKey: .closeAction)
        try super.init(from: decoder)
    }
    
    open override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encodeModelIfPresent(closeAction, forKey: .closeAction)
    }
}
