// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT License.

// <auto-generated/>

#nullable disable

using System;
using System.ClientModel.Primitives;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Configuration;

namespace SampleTypeSpec
{
    /// <summary> Client options for <see cref="SampleTypeSpecClient"/>. </summary>
    public partial class SampleTypeSpecClientOptions : ClientPipelineOptions
    {
        private const ServiceVersion LatestVersion = ServiceVersion.V2024_08_16_Preview;

        /// <summary> Initializes a new instance of SampleTypeSpecClientOptions. </summary>
        /// <param name="version"> The service version. </param>
        public SampleTypeSpecClientOptions(ServiceVersion version = LatestVersion)
        {
            Version = version switch
            {
                ServiceVersion.V2024_07_16_Preview => "2024-07-16-preview",
                ServiceVersion.V2024_08_16_Preview => "2024-08-16-preview",
                _ => throw new NotSupportedException()
            };
        }

        /// <summary> Initializes a new instance of SampleTypeSpecClientOptions from configuration. </summary>
        /// <param name="section"> The configuration section. </param>
        [Experimental("SCME0002")]
        internal SampleTypeSpecClientOptions(IConfigurationSection section) : base(section)
        {
            Version = "2024-08-16-preview";
            if (section is null || !section.Exists())
            {
                return;
            }
            if (section["Version"] is string version)
            {
                Version = version;
            }
        }

        /// <summary> Gets the Version. </summary>
        internal string Version { get; }

        /// <summary> The version of the service to use. </summary>
        public enum ServiceVersion
        {
            /// <summary> V2024_07_16_Preview. </summary>
            V2024_07_16_Preview = 1,
            /// <summary> V2024_08_16_Preview. </summary>
            V2024_08_16_Preview = 2
        }
    }
}
