52 lines
1.8 KiB
Swift
52 lines
1.8 KiB
Swift
//
|
|
// ActionTopAlertModel.swift
|
|
// MVMCore
|
|
//
|
|
// Created by Suresh, Kamlesh on 12/16/19.
|
|
// Copyright © 2019 myverizon. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
@objcMembers public class ActionTopAlertModel: ActionModelProtocol {
|
|
|
|
public static var identifier: String = "topAlert"
|
|
public var actionType: String?
|
|
public var pageType: String
|
|
public var extraParameters: JSONValueDictionary?
|
|
public var analyticsData: JSONValueDictionary?
|
|
// Temporary fix till server changes
|
|
public var title: String?
|
|
|
|
public init(pageType: String) {
|
|
self.pageType = pageType
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey {
|
|
case actionType
|
|
case pageType
|
|
case title
|
|
case extraParameters
|
|
case analyticsData
|
|
}
|
|
|
|
public required init(from decoder: Decoder) throws {
|
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
|
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
|
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
|
|
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
|
|
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
|
|
try encoderContainer.encode(pageType, forKey: .pageType)
|
|
try encoderContainer.encodeIfPresent(title, forKey: .title)
|
|
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
|
|
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
|
|
}
|
|
|
|
|
|
}
|