//
// Generated by SwagGen
// https://github.com/yonaskolb/SwagGen
//

import Foundation
import JSONUtilities

public class OrderedRoute: JSONDecodable, JSONEncodable, PrettyPrintable {

    public var name: String?

    public var naptanIds: [String]?

    public var serviceType: String?

    public init(name: String? = nil, naptanIds: [String]? = nil, serviceType: String? = nil) {
        self.name = name
        self.naptanIds = naptanIds
        self.serviceType = serviceType
    }

    public required init(jsonDictionary: JSONDictionary) throws {
        name = jsonDictionary.json(atKeyPath: "name")
        naptanIds = jsonDictionary.json(atKeyPath: "naptanIds")
        serviceType = jsonDictionary.json(atKeyPath: "serviceType")
    }

    public func encode() -> JSONDictionary {
        var dictionary: JSONDictionary = [:]
        if let name = name {
            dictionary["name"] = name
        }
        if let naptanIds = naptanIds {
            dictionary["naptanIds"] = naptanIds
        }
        if let serviceType = serviceType {
            dictionary["serviceType"] = serviceType
        }
        return dictionary
    }

    /// pretty prints all properties including nested models
    public var prettyPrinted: String {
        return "\(type(of: self)):\n\(encode().recursivePrint(indentIndex: 1))"
    }
}
