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

import Foundation

extension API.SecureTokens {

    /** Lock a user's Secure Token (Auth policies: UserLoginMatchingRequired) */
    public enum UsrLockSecureToken {

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

        public final class Request: APIRequest<Response> {

            public struct Options {

                /** The alias of the secure token */
                public var tknAlias: String

                public init(tknAlias: String) {
                    self.tknAlias = tknAlias
                }
            }

            public var options: Options

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

            /// convenience initialiser so an Option doesn't have to be created
            public convenience init(tknAlias: String) {
                let options = Options(tknAlias: tknAlias)
                self.init(options: options)
            }

            public override var path: String {
                return super.path.replacingOccurrences(of: "{" + "tknAlias" + "}", with: "\(self.options.tknAlias)")
            }
        }

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

            /** Success */
            case status200(BoolResponseLockSecureTokenErrorsApiResponseEntity)

            public var success: BoolResponseLockSecureTokenErrorsApiResponseEntity? {
                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(BoolResponseLockSecureTokenErrorsApiResponseEntity.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
            }
        }
    }
}
