internal static ApiListResultProductStockOperationApiModel DeserializeApiListResultProductStockOperationApiModel(JsonElement element)
        {
            Optional <long> count = default;
            Optional <IReadOnlyList <ProductStockOperationApiModel> > 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 <ProductStockOperationApiModel> array = new List <ProductStockOperationApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ProductStockOperationApiModel.DeserializeProductStockOperationApiModel(item));
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("totalCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    totalCount = property.Value.GetInt64();
                    continue;
                }
            }
            return(new ApiListResultProductStockOperationApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount)));
        }
        internal static ApiResultProductStockOperationApiModel DeserializeApiResultProductStockOperationApiModel(JsonElement element)
        {
            Optional <ProductStockOperationApiModel> data = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    data = ProductStockOperationApiModel.DeserializeProductStockOperationApiModel(property.Value);
                    continue;
                }
            }
            return(new ApiResultProductStockOperationApiModel(data.Value));
        }
        internal static ApiListResultProductStockOperationApiModel DeserializeApiListResultProductStockOperationApiModel(XElement element)
        {
            long?count      = default;
            long?totalCount = default;
            IReadOnlyList <ProductStockOperationApiModel> 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 <ProductStockOperationApiModel>();

            foreach (var e in element.Elements("ProductStockOperationApiModel"))
            {
                array.Add(ProductStockOperationApiModel.DeserializeProductStockOperationApiModel(e));
            }
            data = array;
            return(new ApiListResultProductStockOperationApiModel(count, data, totalCount));
        }