// <auto-generated/>

#nullable disable

using System;
using System.ClientModel.Primitives;
using System.Text;
using System.Text.Json;
using Sample.Models;

namespace Sample
{
    public partial class Dog
    {
        internal static global::Sample.Models.Dog DeserializeDog(global::System.Text.Json.JsonElement element, global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options)
        {
            if ((element.ValueKind == global::System.Text.Json.JsonValueKind.Null))
            {
                return null;
            }
            string species = default;
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
            global::System.ClientModel.Primitives.JsonPatch patch = new global::System.ClientModel.Primitives.JsonPatch((data is null) ? global::System.ReadOnlyMemory<byte>.Empty : data.ToMemory());
#pragma warning restore SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
            bool barks = default;
            foreach (var prop in element.EnumerateObject())
            {
                if (prop.NameEquals("species"u8))
                {
                    species = prop.Value.GetString();
                    continue;
                }
                if (prop.NameEquals("barks"u8))
                {
                    barks = prop.Value.GetBoolean();
                    continue;
                }
                patch.Set([.. "$."u8, .. global::System.Text.Encoding.UTF8.GetBytes(prop.Name)], prop.Value.GetUtf8Bytes());
            }
            return new global::Sample.Models.Dog(species, patch, barks);
        }
    }
}
