//
//  ListLeftVariableRadioButtonAllTextAndLinksModel.swift
//  MVMCoreUI
//
//  Created by Lekshmi S on 13/05/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//


open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
    //--------------------------------------------------
    // MARK: - Properties
    //--------------------------------------------------
    
    open class var identifier: String {
        return "listLVRBAll"
    }
    public var radioButton: RadioButtonModel
    public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
    
    //--------------------------------------------------
    // MARK: - Initializer
    //--------------------------------------------------
    
    public init(radioButton: RadioButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
        self.radioButton = radioButton
        self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
        super.init()
    }
    
    //--------------------------------------------------
    // MARK: - Keys
    //--------------------------------------------------
    
    private enum CodingKeys: String, CodingKey {
        case moleculeName
        case eyebrowHeadlineBodyLink
        case radioButton
    }
    
    //--------------------------------------------------
    // MARK: - Codec
    //--------------------------------------------------
    
    required public init(from decoder: Decoder) throws {
        let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
        radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
        eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink)
        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.encode(moleculeName, forKey: .moleculeName)
        try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink)
        try container.encode(radioButton, forKey: .radioButton)
    }
}
