internal static GetHierarchiesPage DeserializeGetHierarchiesPage(JsonElement element)
        {
            Optional <IReadOnlyList <TimeSeriesHierarchy> > hierarchies = default;
            Optional <string> continuationToken = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hierarchies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TimeSeriesHierarchy> array = new List <TimeSeriesHierarchy>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TimeSeriesHierarchy.DeserializeTimeSeriesHierarchy(item));
                    }
                    hierarchies = array;
                    continue;
                }
                if (property.NameEquals("continuationToken"))
                {
                    continuationToken = property.Value.GetString();
                    continue;
                }
            }
            return(new GetHierarchiesPage(continuationToken.Value, Optional.ToList(hierarchies)));
        }
        internal static TimeSeriesHierarchyOrError DeserializeTimeSeriesHierarchyOrError(JsonElement element)
        {
            Optional <TimeSeriesHierarchy> hierarchy = default;
            Optional <TsiErrorBody>        error     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hierarchy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hierarchy = TimeSeriesHierarchy.DeserializeTimeSeriesHierarchy(property.Value);
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = TsiErrorBody.DeserializeTsiErrorBody(property.Value);
                    continue;
                }
            }
            return(new TimeSeriesHierarchyOrError(hierarchy.Value, error.Value));
        }