// 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> Represents the settings used to configure a <see cref="Notebooks"/> that can be loaded from an <see cref="IConfigurationSection"/>. </summary>
    [Experimental("SCME0002")]
    public partial class NotebooksSettings : ClientSettings
    {
        /// <summary> Gets or sets the SampleTypeSpecUrl. </summary>
        public Uri SampleTypeSpecUrl { get; set; }

        /// <summary> Gets or sets the Notebook. </summary>
        public string Notebook { get; set; }

        /// <summary> Gets or sets the Options. </summary>
        public SampleTypeSpecClientOptions Options { get; set; }

        /// <summary> Binds configuration values from the given section. </summary>
        /// <param name="section"> The configuration section. </param>
        protected override void BindCore(IConfigurationSection section)
        {
            if (Uri.TryCreate(section["SampleTypeSpecUrl"], UriKind.Absolute, out Uri sampleTypeSpecUrl))
            {
                SampleTypeSpecUrl = sampleTypeSpecUrl;
            }
            string notebook = section["Notebook"];
            if (!string.IsNullOrEmpty(notebook))
            {
                Notebook = notebook;
            }
            IConfigurationSection optionsSection = section.GetSection("Options");
            if (optionsSection.Exists())
            {
                Options = new SampleTypeSpecClientOptions(optionsSection);
            }
        }
    }
}
