// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace System.Runtime.CompilerServices
{
    using System;
    using System.CodeDom.Compiler;

    [GeneratedCode("Microsoft.Extensions.Configuration.Binder.SourceGeneration", "42.42.42.42")]
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
    file sealed class InterceptsLocationAttribute : Attribute
    {
        public InterceptsLocationAttribute(int version, string data)
        {
        }
    }
}

namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration
{
    using Microsoft.Extensions.Configuration;
    using System;
    using System.CodeDom.Compiler;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Runtime.CompilerServices;

    [GeneratedCode("Microsoft.Extensions.Configuration.Binder.SourceGeneration", "42.42.42.42")]
    file static class BindingExtensions
    {
        #region IConfiguration extensions.
        /// <summary>Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.</summary>
        [InterceptsLocation(1, "T1w3acs59wB13yghJH3pNu0BAABzcmMtMC5jcw==")] // src-0.cs(18,16)
        public static void Bind_ProgramMyClass0(this IConfiguration configuration, object? instance)
        {
        }

        /// <summary>Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.</summary>
        [InterceptsLocation(1, "T1w3acs59wB13yghJH3pNpACAABzcmMtMC5jcw==")] // src-0.cs(23,16)
        public static void Bind_ProgramMyClass1(this IConfiguration configuration, object? instance, Action<BinderOptions>? configureOptions)
        {
        }

        /// <summary>Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.</summary>
        [InterceptsLocation(1, "T1w3acs59wB13yghJH3pNikDAABzcmMtMC5jcw==")] // src-0.cs(28,16)
        public static void Bind_ProgramMyClass2(this IConfiguration configuration, string key, object? instance)
        {
        }
        #endregion IConfiguration extensions.

        #region Core binding extensions.
        /// <summary>Tries to get the configuration value for the specified key.</summary>
        public static bool TryGetConfigurationValue(IConfiguration configuration, string key, out string? value)
        {
            if (configuration is ConfigurationSection section)
            {
                return section.TryGetValue(key, out value);
            }
        
            value = key != null ? configuration[key] : configuration is IConfigurationSection sec ? sec.Value : null;
            return value != null;
        }

        public static BinderOptions? GetBinderOptions(Action<BinderOptions>? configureOptions)
        {
            if (configureOptions is null)
            {
                return null;
            }
        
            BinderOptions binderOptions = new();
            configureOptions(binderOptions);
        
            if (binderOptions.BindNonPublicProperties)
            {
                throw new NotSupportedException($"The configuration binding source generator does not support 'BinderOptions.BindNonPublicProperties'.");
            }
        
            return binderOptions;
        }
        #endregion Core binding extensions.
    }
}
