internal static ApiListResultEstimateApiModel DeserializeApiListResultEstimateApiModel(JsonElement element)
        {
            Optional <long> count = default;
            Optional <IReadOnlyList <EstimateApiModel> > data = default;
            Optional <long> totalCount = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("count"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    count = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <EstimateApiModel> array = new List <EstimateApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EstimateApiModel.DeserializeEstimateApiModel(item));
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("totalCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    totalCount = property.Value.GetInt64();
                    continue;
                }
            }
            return(new ApiListResultEstimateApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount)));
        }
        internal static ApiResultEstimateApiModel DeserializeApiResultEstimateApiModel(JsonElement element)
        {
            Optional <EstimateApiModel> data = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    data = EstimateApiModel.DeserializeEstimateApiModel(property.Value);
                    continue;
                }
            }
            return(new ApiResultEstimateApiModel(data.Value));
        }
        internal static ApiListResultEstimateApiModel DeserializeApiListResultEstimateApiModel(XElement element)
        {
            long?count      = default;
            long?totalCount = default;
            IReadOnlyList <EstimateApiModel> data = default;

            if (element.Element("count") is XElement countElement)
            {
                count = (long?)countElement;
            }
            if (element.Element("totalCount") is XElement totalCountElement)
            {
                totalCount = (long?)totalCountElement;
            }
            var array = new List <EstimateApiModel>();

            foreach (var e in element.Elements("EstimateApiModel"))
            {
                array.Add(EstimateApiModel.DeserializeEstimateApiModel(e));
            }
            data = array;
            return(new ApiListResultEstimateApiModel(count, data, totalCount));
        }