// <auto-generated/>
#nullable enable

namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses
{
    partial class TestWithMoreThan6Params
    {
        /// <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 __Method9Struct : global::System.Collections.Generic.IReadOnlyList<global::System.Collections.Generic.KeyValuePair<string, object?>>
        {
            private readonly global::System.Int32 _p1;
            private readonly global::System.Int32 _p2;
            private readonly global::System.Int32 _p3;
            private readonly global::System.Int32 _p4;
            private readonly global::System.Int32 _p5;
            private readonly global::System.Int32 _p6;
            private readonly global::System.Collections.Generic.IEnumerable<global::System.Int32> _p7;

            public __Method9Struct(global::System.Int32 p1, global::System.Int32 p2, global::System.Int32 p3, global::System.Int32 p4, global::System.Int32 p5, global::System.Int32 p6, global::System.Collections.Generic.IEnumerable<global::System.Int32> p7)
            {
                this._p1 = p1;
                this._p2 = p2;
                this._p3 = p3;
                this._p4 = p4;
                this._p5 = p5;
                this._p6 = p6;
                this._p7 = p7;

            }

            public override string ToString()
            {
                var p1 = this._p1;
                var p2 = this._p2;
                var p3 = this._p3;
                var p4 = this._p4;
                var p5 = this._p5;
                var p6 = this._p6;
                var p7 = global::__LoggerMessageGenerator.Enumerate((global::System.Collections.IEnumerable ?)this._p7);

                return $"M9 {p1} {p2} {p3} {p4} {p5} {p6} {p7}";
            }

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

            public int Count => 8;

            public global::System.Collections.Generic.KeyValuePair<string, object?> this[int index]
            {
                get => index switch
                {
                    0 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p1", this._p1),
                    1 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p2", this._p2),
                    2 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p3", this._p3),
                    3 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p4", this._p4),
                    4 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p5", this._p5),
                    5 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p6", this._p6),
                    6 => new global::System.Collections.Generic.KeyValuePair<string, object?>("p7", this._p7),
                    7 => new global::System.Collections.Generic.KeyValuePair<string, object?>("{OriginalFormat}", "M9 {p1} {p2} {p3} {p4} {p5} {p6} {p7}"),

                    _ => throw new global::System.IndexOutOfRangeException(nameof(index)),  // 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 < 8; i++)
                {
                    yield return this[i];
                }
            }

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

        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")]
        public static partial void Method9(global::Microsoft.Extensions.Logging.ILogger logger, global::System.Int32 p1, global::System.Int32 p2, global::System.Int32 p3, global::System.Int32 p4, global::System.Int32 p5, global::System.Int32 p6, global::System.Collections.Generic.IEnumerable<global::System.Int32> p7)
        {
            if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Error))
            {
                logger.Log(
                    global::Microsoft.Extensions.Logging.LogLevel.Error,
                    new global::Microsoft.Extensions.Logging.EventId(8, nameof(Method9)),
                    new __Method9Struct(p1, p2, p3, p4, p5, p6, p7),
                    null,
                    __Method9Struct.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)]
internal static class __LoggerMessageGenerator
{
    public static string Enumerate(global::System.Collections.IEnumerable? enumerable)
    {
        if (enumerable == null)
        {
            return "(null)";
        }

        var sb = new global::System.Text.StringBuilder();
        _ = sb.Append('[');

        bool first = true;
        foreach (object e in enumerable)
        {
            if (!first)
            {
                _ = sb.Append(", ");
            }

            if (e == null)
            {
                _ = sb.Append("(null)");
            }
            else
            {
                if (e is global::System.IFormattable fmt)
                {
                    _ = sb.Append(fmt.ToString(null, global::System.Globalization.CultureInfo.InvariantCulture));
                }
                else
                {
                    _ = sb.Append(e);
                }
            }

            first = false;
        }

        _ = sb.Append(']');

        return sb.ToString();
    }
}