//
//  ListRightVariableToggleAllTextAndLinksModel.swift
//  MVMCoreUI
//
//  Created by Scott Pfeil on 6/25/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//


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