// <auto-generated/>
#nullable enable

namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses
{
    partial class TestWithGenericMethods
    {
        /// <summary> This API supports the logging infrastructure and is not intended to be used directly from your code. It is subject to change in the future. </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
        private readonly struct __M0Struct<TCode> : global::System.Collections.Generic.IReadOnlyList<global::System.Collections.Generic.KeyValuePair<string, object?>>
                where TCode : struct, global::System.Enum
        {
            private readonly TCode _code;

            public __M0Struct(TCode code)
            {
                this._code = code;

            }

            public override string ToString()
            {
                var code = this._code;

                return string.Create(global::System.Globalization.CultureInfo.InvariantCulture, $"M0 {code}");
            }

            public static readonly global::System.Func<__M0Struct<TCode>, global::System.Exception?, string> Format = (state, ex) => state.ToString();

            public int Count => 2;

            public global::System.Collections.Generic.KeyValuePair<string, object?> this[int index]
            {
                get => index switch
                {
                    0 => new global::System.Collections.Generic.KeyValuePair<string, object?>("code", this._code),
                    1 => new global::System.Collections.Generic.KeyValuePair<string, object?>("{OriginalFormat}", "M0 {code}"),

                    _ => throw new global::System.IndexOutOfRangeException(),  // return the same exception LoggerMessage.Define returns in this case
                };
            }

            public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<string, object?>> GetEnumerator()
            {
                for (int i = 0; i < 2; i++)
                {
                    yield return this[i];
                }
            }

            global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
        }

        /// <summary>
        /// <para><b>Message:</b> M0 {code}</para>
        /// <para><b>Level:</b> Trace</para>
        /// </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        public static partial void M0<TCode>(global::Microsoft.Extensions.Logging.ILogger logger, TCode code)
            where TCode : struct, global::System.Enum
        {
            if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Trace))
            {
                logger.Log(
                    global::Microsoft.Extensions.Logging.LogLevel.Trace,
                    new global::Microsoft.Extensions.Logging.EventId(0, nameof(M0)),
                    new __M0Struct<TCode>(code),
                    null,
                    __M0Struct<TCode>.Format);
            }
        }
        /// <summary> This API supports the logging infrastructure and is not intended to be used directly from your code. It is subject to change in the future. </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
        private readonly struct __M1Struct<T1, T2> : global::System.Collections.Generic.IReadOnlyList<global::System.Collections.Generic.KeyValuePair<string, object?>>
                where T1 : class
                where T2 : new()
        {
            private readonly T1 _value;
            private readonly T2 _extra;

            public __M1Struct(T1 value, T2 extra)
            {
                this._value = value;
                this._extra = extra;

            }

            public override string ToString()
            {
                var value = this._value;
                var extra = this._extra;

                return string.Create(global::System.Globalization.CultureInfo.InvariantCulture, $"M1 {value} {extra}");
            }

            public static readonly global::System.Func<__M1Struct<T1, T2>, global::System.Exception?, string> Format = (state, ex) => state.ToString();

            public int Count => 3;

            public global::System.Collections.Generic.KeyValuePair<string, object?> this[int index]
            {
                get => index switch
                {
                    0 => new global::System.Collections.Generic.KeyValuePair<string, object?>("value", this._value),
                    1 => new global::System.Collections.Generic.KeyValuePair<string, object?>("extra", this._extra),
                    2 => new global::System.Collections.Generic.KeyValuePair<string, object?>("{OriginalFormat}", "M1 {value} {extra}"),

                    _ => throw new global::System.IndexOutOfRangeException(),  // return the same exception LoggerMessage.Define returns in this case
                };
            }

            public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<string, object?>> GetEnumerator()
            {
                for (int i = 0; i < 3; i++)
                {
                    yield return this[i];
                }
            }

            global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
        }

        /// <summary>
        /// <para><b>Message:</b> M1 {value} {extra}</para>
        /// <para><b>Level:</b> Debug</para>
        /// </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        public static partial void M1<T1, T2>(global::Microsoft.Extensions.Logging.ILogger logger, T1 value, T2 extra)
            where T1 : class
            where T2 : new()
        {
            if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Debug))
            {
                logger.Log(
                    global::Microsoft.Extensions.Logging.LogLevel.Debug,
                    new global::Microsoft.Extensions.Logging.EventId(1, nameof(M1)),
                    new __M1Struct<T1, T2>(value, extra),
                    null,
                    __M1Struct<T1, T2>.Format);
            }
        }
        /// <summary> This API supports the logging infrastructure and is not intended to be used directly from your code. It is subject to change in the future. </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
        private readonly struct __M2Struct<T> : global::System.Collections.Generic.IReadOnlyList<global::System.Collections.Generic.KeyValuePair<string, object?>>
        {
            private readonly T _value;

            public __M2Struct(T value)
            {
                this._value = value;

            }

            public override string ToString()
            {
                var value = this._value;

                return string.Create(global::System.Globalization.CultureInfo.InvariantCulture, $"M2 {value}");
            }

            public static readonly global::System.Func<__M2Struct<T>, global::System.Exception?, string> Format = (state, ex) => state.ToString();

            public int Count => 2;

            public global::System.Collections.Generic.KeyValuePair<string, object?> this[int index]
            {
                get => index switch
                {
                    0 => new global::System.Collections.Generic.KeyValuePair<string, object?>("value", this._value),
                    1 => new global::System.Collections.Generic.KeyValuePair<string, object?>("{OriginalFormat}", "M2 {value}"),

                    _ => throw new global::System.IndexOutOfRangeException(),  // return the same exception LoggerMessage.Define returns in this case
                };
            }

            public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<string, object?>> GetEnumerator()
            {
                for (int i = 0; i < 2; i++)
                {
                    yield return this[i];
                }
            }

            global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
        }

        /// <summary>
        /// <para><b>Message:</b> M2 {value}</para>
        /// <para><b>Level:</b> Information</para>
        /// </summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        public static partial void M2<T>(global::Microsoft.Extensions.Logging.ILogger logger, T value)
        {
            if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Information))
            {
                logger.Log(
                    global::Microsoft.Extensions.Logging.LogLevel.Information,
                    new global::Microsoft.Extensions.Logging.EventId(2, nameof(M2)),
                    new __M2Struct<T>(value),
                    null,
                    __M2Struct<T>.Format);
            }
        }
    }
}