//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import SotoCore

/// Error enum for KinesisVideo
public struct KinesisVideoErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case accountChannelLimitExceededException = "AccountChannelLimitExceededException"
        case accountStreamLimitExceededException = "AccountStreamLimitExceededException"
        case clientLimitExceededException = "ClientLimitExceededException"
        case deviceStreamLimitExceededException = "DeviceStreamLimitExceededException"
        case invalidArgumentException = "InvalidArgumentException"
        case invalidDeviceException = "InvalidDeviceException"
        case invalidResourceFormatException = "InvalidResourceFormatException"
        case notAuthorizedException = "NotAuthorizedException"
        case resourceInUseException = "ResourceInUseException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case tagsPerResourceExceededLimitException = "TagsPerResourceExceededLimitException"
        case versionMismatchException = "VersionMismatchException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize KinesisVideo
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// You do not have required permissions to perform this operation.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    /// You have reached the maximum limit of active signaling channels for this AWS account in this region.
    public static var accountChannelLimitExceededException: Self { .init(.accountChannelLimitExceededException) }
    /// The number of streams created for the account is too high.
    public static var accountStreamLimitExceededException: Self { .init(.accountStreamLimitExceededException) }
    /// Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later.
    public static var clientLimitExceededException: Self { .init(.clientLimitExceededException) }
    /// Not implemented.
    public static var deviceStreamLimitExceededException: Self { .init(.deviceStreamLimitExceededException) }
    /// The value for this input parameter is invalid.
    public static var invalidArgumentException: Self { .init(.invalidArgumentException) }
    /// Not implemented.
    public static var invalidDeviceException: Self { .init(.invalidDeviceException) }
    /// The format of the StreamARN is invalid.
    public static var invalidResourceFormatException: Self { .init(.invalidResourceFormatException) }
    /// The caller is not authorized to perform this operation.
    public static var notAuthorizedException: Self { .init(.notAuthorizedException) }
    /// The signaling channel is currently not available for this operation.
    public static var resourceInUseException: Self { .init(.resourceInUseException) }
    /// Amazon Kinesis Video Streams can't find the stream that you specified.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// You have exceeded the limit of tags that you can associate with the resource. Kinesis video streams support up to 50 tags.
    public static var tagsPerResourceExceededLimitException: Self { .init(.tagsPerResourceExceededLimitException) }
    /// The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream API.
    public static var versionMismatchException: Self { .init(.versionMismatchException) }
}

extension KinesisVideoErrorType: Equatable {
    public static func == (lhs: KinesisVideoErrorType, rhs: KinesisVideoErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension KinesisVideoErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
