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

import Foundation

public class PlannedWork: Codable, Equatable {

    public var createdDateTime: DateTime?

    public var description: String?

    public var id: String?

    public var lastUpdateDateTime: DateTime?

    public init(createdDateTime: DateTime? = nil, description: String? = nil, id: String? = nil, lastUpdateDateTime: DateTime? = nil) {
        self.createdDateTime = createdDateTime
        self.description = description
        self.id = id
        self.lastUpdateDateTime = lastUpdateDateTime
    }

    private enum CodingKeys: String, CodingKey {
        case createdDateTime
        case description
        case id
        case lastUpdateDateTime
    }

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

        createdDateTime = try container.decodeIfPresent(.createdDateTime)
        description = try container.decodeIfPresent(.description)
        id = try container.decodeIfPresent(.id)
        lastUpdateDateTime = try container.decodeIfPresent(.lastUpdateDateTime)
    }

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

        try container.encodeIfPresent(createdDateTime, forKey: .createdDateTime)
        try container.encodeIfPresent(description, forKey: .description)
        try container.encodeIfPresent(id, forKey: .id)
        try container.encodeIfPresent(lastUpdateDateTime, forKey: .lastUpdateDateTime)
    }

    public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? PlannedWork else { return false }
      guard self.createdDateTime == object.createdDateTime else { return false }
      guard self.description == object.description else { return false }
      guard self.id == object.id else { return false }
      guard self.lastUpdateDateTime == object.lastUpdateDateTime else { return false }
      return true
    }

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