// <auto-generated/>

#nullable disable

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

namespace Sample
{
    public partial class DynamicModel
    {
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
        private bool PropagateGet(global::System.ReadOnlySpan<byte> jsonPath, out global::System.ClientModel.Primitives.JsonPatch.EncodedValue value)
        {
            global::System.ReadOnlySpan<byte> local = jsonPath.SliceToStartOfPropertyName();
            value = default;

            if (local.StartsWith("p1"u8))
            {
                int propertyLength = "p1"u8.Length;
                global::System.ReadOnlySpan<byte> currentSlice = local.Slice(propertyLength);
                string key = currentSlice.GetFirstPropertyName(out int i);
                if (!P1.TryGetValue(key, out global::Sample.Models.AnotherDynamic item))
                {
                    return false;
                }
                return item.Patch.TryGetEncodedValue([.. "$"u8, .. currentSlice.GetRemainder(i)], out value);
            }
            return false;
        }
#pragma warning restore SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.

#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
        private bool PropagateSet(global::System.ReadOnlySpan<byte> jsonPath, global::System.ClientModel.Primitives.JsonPatch.EncodedValue value)
        {
            global::System.ReadOnlySpan<byte> local = jsonPath.SliceToStartOfPropertyName();

            if (local.StartsWith("p1"u8))
            {
                int propertyLength = "p1"u8.Length;
                global::System.ReadOnlySpan<byte> currentSlice = local.Slice(propertyLength);
                string key = currentSlice.GetFirstPropertyName(out int i);
                if (!P1.TryGetValue(key, out global::Sample.Models.AnotherDynamic item))
                {
                    return false;
                }
                item.Patch.Set([.. "$"u8, .. currentSlice.GetRemainder(i)], value);
                return true;
            }
            return false;
        }
#pragma warning restore SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
    }
}
