﻿// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

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

namespace Intake.Contracts
{
    public partial class JobJson
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Intake.Contracts.JobProblem>? _JobProblem;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        #nullable disable annotations // Marking the property type as nullable-oblivious.
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Intake.Contracts.JobProblem> JobProblem
        #nullable enable annotations
        {
            get => _JobProblem ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Intake.Contracts.JobProblem>)Options.GetTypeInfo(typeof(global::Intake.Contracts.JobProblem));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Intake.Contracts.JobProblem> Create_JobProblem(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Intake.Contracts.JobProblem>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Intake.Contracts.JobProblem> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Intake.Contracts.JobProblem>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Intake.Contracts.JobProblem((string)args[0], (string)args[1]),
                    PropertyMetadataInitializer = _ => JobProblemPropInit(options),
                    ConstructorParameterMetadataInitializer = JobProblemCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Intake.Contracts.JobProblem).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string)}, modifiers: null),
                    SerializeHandler = JobProblemSerializeHandler,
                    PolymorphismOptions = new global::System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions(),
                    TypeClassifierFactory = null,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Intake.Contracts.JobProblem>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] JobProblemPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Intake.Contracts.JobProblem),
                Converter = null,
                Getter = static obj => ((global::Intake.Contracts.JobProblem)obj).Code,
                Setter = static (obj, value) => __set_JobProblem_Code((global::Intake.Contracts.JobProblem)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Code",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Intake.Contracts.JobProblem).GetProperty("Code", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
            properties[0].IsGetNullable = false;
            properties[0].IsSetNullable = false;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Intake.Contracts.JobProblem),
                Converter = null,
                Getter = static obj => ((global::Intake.Contracts.JobProblem)obj).Message,
                Setter = static (obj, value) => __set_JobProblem_Message((global::Intake.Contracts.JobProblem)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Message",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Intake.Contracts.JobProblem).GetProperty("Message", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
            properties[1].IsGetNullable = false;
            properties[1].IsSetNullable = false;

            return properties;
        }

        // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
        // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
        private void JobProblemSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Intake.Contracts.JobProblem? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_code, ((global::Intake.Contracts.JobProblem)value).Code);
            writer.WriteString(PropName_message, ((global::Intake.Contracts.JobProblem)value).Message);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] JobProblemCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Code",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "Message",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },
        };

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Code")]
        private static extern void __set_JobProblem_Code(global::Intake.Contracts.JobProblem obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Message")]
        private static extern void __set_JobProblem_Message(global::Intake.Contracts.JobProblem obj, string value);
    }
}
