// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------

import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length

/// User-configurable client options.
internal struct AzureCommunicationChatClientOptionsInternal: ClientOptions {
    /// The API version of the client to invoke.
    internal let apiVersion: String
    /// The `ClientLogger` to be used by this client.
    internal let logger: ClientLogger
    /// Options for configuring telemetry sent by this client.
    internal let telemetryOptions: TelemetryOptions
    /// Global transport options
    internal let transportOptions: TransportOptions
    /// The default dispatch queue on which to call all completion handler. Defaults to `DispatchQueue.main`.
    internal let dispatchQueue: DispatchQueue?

    /// API version of the  to invoke. Defaults to the latest.
    internal enum ApiVersion: RequestStringConvertible {
        /// Custom value for unrecognized enum values
        case custom(String)
        /// API version "2021-09-07"
        case v20210907

        /// The most recent API version of the
        internal static var latest: ApiVersion {
            return .v20210907
        }

        internal var requestString: String {
            switch self {
            case let .custom(val):
                return val
            case .v20210907:
                return "2021-09-07"
            }
        }

        internal init(_ val: String) {
            switch val.lowercased() {
            case "2021-09-07":
                self = .v20210907
            default:
                self = .custom(val)
            }
        }
    }

    /// Initialize a `AzureCommunicationChatClientOptionsInternal` structure.
    /// - Parameters:
    ///   - apiVersion: The API version of the client to invoke.
    ///   - logger: The `ClientLogger` to be used by this client.
    ///   - telemetryOptions: Options for configuring telemetry sent by this client.
    ///   - cancellationToken: A token used to make a best-effort attempt at canceling a request.
    ///   - dispatchQueue: The default dispatch queue on which to call all completion handler. Defaults to
    /// `DispatchQueue.main`.
    internal init(
        apiVersion: AzureCommunicationChatClientOptionsInternal.ApiVersion = .latest,
        logger: ClientLogger = ClientLoggers.default(tag: "AzureCommunicationChat"),
        telemetryOptions: TelemetryOptions = TelemetryOptions(),
        transportOptions: TransportOptions? = nil,
        dispatchQueue: DispatchQueue? = nil
    ) {
        self.apiVersion = apiVersion.requestString
        self.logger = logger
        self.telemetryOptions = telemetryOptions
        self.transportOptions = transportOptions ?? TransportOptions()
        self.dispatchQueue = dispatchQueue
    }
}
