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

import Foundation

public class AllowedConnectorDtoPaginatedListEntity: APIModel {

    public var hasNextPage: Bool?

    public var hasPreviousPage: Bool?

    public var items: [AllowedConnectorDtoEntity]?

    public var pageNumber: Int?

    public init(hasNextPage: Bool? = nil, hasPreviousPage: Bool? = nil, items: [AllowedConnectorDtoEntity]? = nil, pageNumber: Int? = nil) {
        self.hasNextPage = hasNextPage
        self.hasPreviousPage = hasPreviousPage
        self.items = items
        self.pageNumber = pageNumber
    }

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

        hasNextPage = try container.decodeIfPresent("hasNextPage")
        hasPreviousPage = try container.decodeIfPresent("hasPreviousPage")
        items = try container.decodeArrayIfPresent("items")
        pageNumber = try container.decodeIfPresent("pageNumber")
    }

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

        try container.encodeIfPresent(hasNextPage, forKey: "hasNextPage")
        try container.encodeIfPresent(hasPreviousPage, forKey: "hasPreviousPage")
        try container.encodeIfPresent(items, forKey: "items")
        try container.encodeIfPresent(pageNumber, forKey: "pageNumber")
    }

    public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? AllowedConnectorDtoPaginatedListEntity else { return false }
      guard self.hasNextPage == object.hasNextPage else { return false }
      guard self.hasPreviousPage == object.hasPreviousPage else { return false }
      guard self.items == object.items else { return false }
      guard self.pageNumber == object.pageNumber else { return false }
      return true
    }

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