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

import Foundation

public class FormatTest: APIModel {

    public var number: Double

    public var byte: File

    public var date: DateDay

    public var password: String

    public var binary: File?

    public var dateTime: DateTime?

    public var double: Double?

    public var float: Float?

    public var int32: Int?

    public var int64: Int?

    public var integer: Int?

    public var string: String?

    public var uuid: ID?

    public init(number: Double, byte: File, date: DateDay, password: String, binary: File? = nil, dateTime: DateTime? = nil, double: Double? = nil, float: Float? = nil, int32: Int? = nil, int64: Int? = nil, integer: Int? = nil, string: String? = nil, uuid: ID? = nil) {
        self.number = number
        self.byte = byte
        self.date = date
        self.password = password
        self.binary = binary
        self.dateTime = dateTime
        self.double = double
        self.float = float
        self.int32 = int32
        self.int64 = int64
        self.integer = integer
        self.string = string
        self.uuid = uuid
    }

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

        number = try container.decode("number")
        byte = try container.decode("byte")
        date = try container.decode("date")
        password = try container.decode("password")
        binary = try container.decodeIfPresent("binary")
        dateTime = try container.decodeIfPresent("dateTime")
        double = try container.decodeIfPresent("double")
        float = try container.decodeIfPresent("float")
        int32 = try container.decodeIfPresent("int32")
        int64 = try container.decodeIfPresent("int64")
        integer = try container.decodeIfPresent("integer")
        string = try container.decodeIfPresent("string")
        uuid = try container.decodeIfPresent("uuid")
    }

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

        try container.encode(number, forKey: "number")
        try container.encode(byte, forKey: "byte")
        try container.encode(date, forKey: "date")
        try container.encode(password, forKey: "password")
        try container.encodeIfPresent(binary, forKey: "binary")
        try container.encodeIfPresent(dateTime, forKey: "dateTime")
        try container.encodeIfPresent(double, forKey: "double")
        try container.encodeIfPresent(float, forKey: "float")
        try container.encodeIfPresent(int32, forKey: "int32")
        try container.encodeIfPresent(int64, forKey: "int64")
        try container.encodeIfPresent(integer, forKey: "integer")
        try container.encodeIfPresent(string, forKey: "string")
        try container.encodeIfPresent(uuid, forKey: "uuid")
    }

    public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? FormatTest else { return false }
      guard self.number == object.number else { return false }
      guard self.byte == object.byte else { return false }
      guard self.date == object.date else { return false }
      guard self.password == object.password else { return false }
      guard self.binary == object.binary else { return false }
      guard self.dateTime == object.dateTime else { return false }
      guard self.double == object.double else { return false }
      guard self.float == object.float else { return false }
      guard self.int32 == object.int32 else { return false }
      guard self.int64 == object.int64 else { return false }
      guard self.integer == object.integer else { return false }
      guard self.string == object.string else { return false }
      guard self.uuid == object.uuid else { return false }
      return true
    }

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