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

import Foundation
import JSONUtilities

public class Mode: JSONDecodable, JSONEncodable, PrettyPrintable {

    public var isFarePaying: Bool?

    public var isScheduledService: Bool?

    public var isTflService: Bool?

    public var modeName: String?

    public init(isFarePaying: Bool? = nil, isScheduledService: Bool? = nil, isTflService: Bool? = nil, modeName: String? = nil) {
        self.isFarePaying = isFarePaying
        self.isScheduledService = isScheduledService
        self.isTflService = isTflService
        self.modeName = modeName
    }

    public required init(jsonDictionary: JSONDictionary) throws {
        isFarePaying = jsonDictionary.json(atKeyPath: "isFarePaying")
        isScheduledService = jsonDictionary.json(atKeyPath: "isScheduledService")
        isTflService = jsonDictionary.json(atKeyPath: "isTflService")
        modeName = jsonDictionary.json(atKeyPath: "modeName")
    }

    public func encode() -> JSONDictionary {
        var dictionary: JSONDictionary = [:]
        if let isFarePaying = isFarePaying {
            dictionary["isFarePaying"] = isFarePaying
        }
        if let isScheduledService = isScheduledService {
            dictionary["isScheduledService"] = isScheduledService
        }
        if let isTflService = isTflService {
            dictionary["isTflService"] = isTflService
        }
        if let modeName = modeName {
            dictionary["modeName"] = modeName
        }
        return dictionary
    }

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