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

import Foundation

/** Creates a new event object at lat/lng from this POI ID */
public class PCPOIMoveRequest: APIModel {

    /** Creates a new event object at lat/lng from this POI ID */
    public enum PCPOIType: String, Codable, Equatable, CaseIterable {
        case movePoi = "movePoi"
    }

    public var attributes: Attributes?

    /** UUID of the POI that is going to be moved */
    public var id: ID?

    public var type: PCPOIType?

    /** Creates a new event object at lat/lng from this POI ID */
    public class Attributes: APIModel {

        /** Latitude in degrees */
        public var latitude: Float?

        /** Longitude in degrees */
        public var longitude: Float?

        public init(latitude: Float? = nil, longitude: Float? = nil) {
            self.latitude = latitude
            self.longitude = longitude
        }

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

            latitude = try container.decodeIfPresent("latitude")
            longitude = try container.decodeIfPresent("longitude")
        }

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

            try container.encodeIfPresent(latitude, forKey: "latitude")
            try container.encodeIfPresent(longitude, forKey: "longitude")
        }

        public func isEqual(to object: Any?) -> Bool {
          guard let object = object as? Attributes else { return false }
          guard self.latitude == object.latitude else { return false }
          guard self.longitude == object.longitude else { return false }
          return true
        }

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

    public init(attributes: Attributes? = nil, id: ID? = nil, type: PCPOIType? = nil) {
        self.attributes = attributes
        self.id = id
        self.type = type
    }

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

        attributes = try container.decodeIfPresent("attributes")
        id = try container.decodeIfPresent("id")
        type = try container.decodeIfPresent("type")
    }

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

        try container.encodeIfPresent(attributes, forKey: "attributes")
        try container.encodeIfPresent(id, forKey: "id")
        try container.encodeIfPresent(type, forKey: "type")
    }

    public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? PCPOIMoveRequest else { return false }
      guard self.attributes == object.attributes else { return false }
      guard self.id == object.id else { return false }
      guard self.type == object.type else { return false }
      return true
    }

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