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

import Foundation

public class CycleSuperhighway: Codable, Equatable {

    /** A LineString or MultiLineString that forms the route of the highway */
    public var geography: DbGeography?

    /** The Id */
    public var id: String?

    /** The long label to show on maps when zoomed in */
    public var label: String?

    /** The short label to show on maps */
    public var labelShort: String?

    /** When the data was last updated */
    public var modified: DateTime?

    /** True if the route is split into segments */
    public var segmented: Bool?

    public init(geography: DbGeography? = nil, id: String? = nil, label: String? = nil, labelShort: String? = nil, modified: DateTime? = nil, segmented: Bool? = nil) {
        self.geography = geography
        self.id = id
        self.label = label
        self.labelShort = labelShort
        self.modified = modified
        self.segmented = segmented
    }

    private enum CodingKeys: String, CodingKey {
        case geography
        case id
        case label
        case labelShort
        case modified
        case segmented
    }

    public required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)

        geography = try container.decodeIfPresent(.geography)
        id = try container.decodeIfPresent(.id)
        label = try container.decodeIfPresent(.label)
        labelShort = try container.decodeIfPresent(.labelShort)
        modified = try container.decodeIfPresent(.modified)
        segmented = try container.decodeIfPresent(.segmented)
    }

    public func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)

        try container.encodeIfPresent(geography, forKey: .geography)
        try container.encodeIfPresent(id, forKey: .id)
        try container.encodeIfPresent(label, forKey: .label)
        try container.encodeIfPresent(labelShort, forKey: .labelShort)
        try container.encodeIfPresent(modified, forKey: .modified)
        try container.encodeIfPresent(segmented, forKey: .segmented)
    }

    public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? CycleSuperhighway else { return false }
      guard self.geography == object.geography else { return false }
      guard self.id == object.id else { return false }
      guard self.label == object.label else { return false }
      guard self.labelShort == object.labelShort else { return false }
      guard self.modified == object.modified else { return false }
      guard self.segmented == object.segmented else { return false }
      return true
    }

    public static func == (lhs: CycleSuperhighway, rhs: CycleSuperhighway) -> Bool {
        return lhs.isEqual(to: rhs)
    }
}
