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

import Foundation

extension API.SecureTokens {

    /**  (Auth policies: UserLoginMatchingRequired) */
    public enum UsrGetSecureTokens {

        public static let service = APIService<Response>(id: "UsrGetSecureTokens", tag: "SecureTokens", method: "GET", path: "/mfa/me/secure-tokens", hasBody: false, securityRequirements: [SecurityRequirement(type: "Bearer", scopes: [])])

        public final class Request: APIRequest<Response> {

            public struct Options {

                public var pageNumber: Int?

                public var pageSize: Int?

                /** Response includes objetcs having the "SOFT-DELETED" status. The default value is 'TRUE'. */
                public var isSoftDeleted: Bool?

                /** Response includes objects having the "NOT-ENROLLED" status. The default value is 'FALSE'. */
                public var includeUnenrolled: Bool?

                public init(pageNumber: Int? = nil, pageSize: Int? = nil, isSoftDeleted: Bool? = nil, includeUnenrolled: Bool? = nil) {
                    self.pageNumber = pageNumber
                    self.pageSize = pageSize
                    self.isSoftDeleted = isSoftDeleted
                    self.includeUnenrolled = includeUnenrolled
                }
            }

            public var options: Options

            public init(options: Options) {
                self.options = options
                super.init(service: UsrGetSecureTokens.service)
            }

            /// convenience initialiser so an Option doesn't have to be created
            public convenience init(pageNumber: Int? = nil, pageSize: Int? = nil, isSoftDeleted: Bool? = nil, includeUnenrolled: Bool? = nil) {
                let options = Options(pageNumber: pageNumber, pageSize: pageSize, isSoftDeleted: isSoftDeleted, includeUnenrolled: includeUnenrolled)
                self.init(options: options)
            }

            public override var path: String {
                return super.path
            }

            public override var queryParameters: [String: Any] {
                var params: [String: Any] = [:]
                if let pageNumber = options.pageNumber {
                  params["PageNumber"] = pageNumber
                }
                if let pageSize = options.pageSize {
                  params["PageSize"] = pageSize
                }
                if let isSoftDeleted = options.isSoftDeleted {
                  params["IsSoftDeleted"] = isSoftDeleted
                }
                if let includeUnenrolled = options.includeUnenrolled {
                  params["IncludeUnenrolled"] = includeUnenrolled
                }
                return params
            }
        }

        public enum Response: APIResponseValue, CustomStringConvertible, CustomDebugStringConvertible {
            public typealias SuccessType = SecureTokenDtoPaginatedListEntity

            /** Success */
            case status200(SecureTokenDtoPaginatedListEntity)

            public var success: SecureTokenDtoPaginatedListEntity? {
                switch self {
                case .status200(let response): return response
                }
            }

            public var response: Any {
                switch self {
                case .status200(let response): return response
                }
            }

            public var statusCode: Int {
                switch self {
                case .status200: return 200
                }
            }

            public var successful: Bool {
                switch self {
                case .status200: return true
                }
            }

            public init(statusCode: Int, data: Data, decoder: ResponseDecoder) throws {
                switch statusCode {
                case 200: self = try .status200(decoder.decode(SecureTokenDtoPaginatedListEntity.self, from: data))
                default: throw APIClientError.unexpectedStatusCode(statusCode: statusCode, data: data)
                }
            }

            public var description: String {
                return "\(statusCode) \(successful ? "success" : "failure")"
            }

            public var debugDescription: String {
                var string = description
                let responseString = "\(response)"
                if responseString != "()" {
                    string += "\n\(responseString)"
                }
                return string
            }
        }
    }
}
