// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
//go:build !goverter

package generated

import (
	ozon "git.denco.store/fakz9/ozon-api-client/ozon"
	products "sipro-mps/api/generated/v1/ozon/products"
	mapping "sipro-mps/internal/ozon/products/mapping"
)

type ConverterImpl struct{}

func (c *ConverterImpl) AttributesToProto(source *ozon.GetDescriptionOfProductsResult) *products.ProductAttributes {
	var pProductsProductAttributes *products.ProductAttributes
	if source != nil {
		var productsProductAttributes products.ProductAttributes
		productsProductAttributes.Id = (*source).Id
		productsProductAttributes.Barcode = (*source).Barcode
		productsProductAttributes.Name = (*source).Name
		productsProductAttributes.OfferId = (*source).OfferId
		productsProductAttributes.TypeId = (*source).TypeId
		productsProductAttributes.Height = mapping.Int32ToInt64((*source).Height)
		productsProductAttributes.Depth = mapping.Int32ToInt64((*source).Depth)
		productsProductAttributes.Width = mapping.Int32ToInt64((*source).Width)
		productsProductAttributes.DimensionUnit = (*source).DimensionUnit
		productsProductAttributes.Weight = mapping.Int32ToInt64((*source).Weight)
		productsProductAttributes.WeightUnit = (*source).WeightUnit
		productsProductAttributes.PrimaryImage = (*source).PrimaryImage
		productsProductAttributes.ModelInfo = c.pOzonModelInfoToPProductsProductAttributes_ModelInfo((*source).ModelInfo)
		if (*source).Images != nil {
			productsProductAttributes.Images = make([]string, len((*source).Images))
			for i := 0; i < len((*source).Images); i++ {
				productsProductAttributes.Images[i] = (*source).Images[i]
			}
		}
		if (*source).Attributes != nil {
			productsProductAttributes.Attributes = make([]*products.ProductAttributes_Attributes, len((*source).Attributes))
			for j := 0; j < len((*source).Attributes); j++ {
				productsProductAttributes.Attributes[j] = c.ozonGetDescriptionOfProductsAttributeToPProductsProductAttributes_Attributes((*source).Attributes[j])
			}
		}
		productsProductAttributes.ColorImage = (*source).ColorImage
		productsProductAttributes.DescriptionCategoryId = (*source).DescriptionCategoryId
		pProductsProductAttributes = &productsProductAttributes
	}
	return pProductsProductAttributes
}
func (c *ConverterImpl) ProtoToUpdateItem(source *products.CreateOrUpdateProductsRequest_Item) *ozon.CreateOrUpdateProductItem {
	var pOzonCreateOrUpdateProductItem *ozon.CreateOrUpdateProductItem
	if source != nil {
		var ozonCreateOrUpdateProductItem ozon.CreateOrUpdateProductItem
		if (*source).Attributes != nil {
			ozonCreateOrUpdateProductItem.Attributes = make([]ozon.CreateOrUpdateAttribute, len((*source).Attributes))
			for i := 0; i < len((*source).Attributes); i++ {
				ozonCreateOrUpdateProductItem.Attributes[i] = c.pProductsCreateOrUpdateProductsRequest_Item_AttributesToOzonCreateOrUpdateAttribute((*source).Attributes[i])
			}
		}
		ozonCreateOrUpdateProductItem.Barcode = (*source).Barcode
		ozonCreateOrUpdateProductItem.DescriptionCategoryId = (*source).DescriptionCategoryId
		ozonCreateOrUpdateProductItem.NewDescriptionCategoryId = (*source).NewDescriptionCategoryId
		ozonCreateOrUpdateProductItem.ColorImage = (*source).ColorImage
		ozonCreateOrUpdateProductItem.Depth = mapping.Int64ToInt32((*source).Depth)
		ozonCreateOrUpdateProductItem.DimensionUnit = (*source).DimensionUnit
		ozonCreateOrUpdateProductItem.Height = mapping.Int64ToInt32((*source).Height)
		if (*source).Images != nil {
			ozonCreateOrUpdateProductItem.Images = make([]string, len((*source).Images))
			for j := 0; j < len((*source).Images); j++ {
				ozonCreateOrUpdateProductItem.Images[j] = (*source).Images[j]
			}
		}
		ozonCreateOrUpdateProductItem.PrimaryImage = (*source).PrimaryImage
		if (*source).Images360 != nil {
			ozonCreateOrUpdateProductItem.Images360 = make([]string, len((*source).Images360))
			for k := 0; k < len((*source).Images360); k++ {
				ozonCreateOrUpdateProductItem.Images360[k] = (*source).Images360[k]
			}
		}
		ozonCreateOrUpdateProductItem.Name = (*source).Name
		ozonCreateOrUpdateProductItem.OfferId = (*source).OfferId
		ozonCreateOrUpdateProductItem.CurrencyCode = (*source).CurrencyCode
		ozonCreateOrUpdateProductItem.OldPrice = (*source).OldPrice
		if (*source).PdfList != nil {
			ozonCreateOrUpdateProductItem.PDFList = make([]ozon.CreateOrUpdateProductPDF, len((*source).PdfList))
			for l := 0; l < len((*source).PdfList); l++ {
				ozonCreateOrUpdateProductItem.PDFList[l] = c.pProductsCreateOrUpdateProductsRequest_Item_PdfListItemToOzonCreateOrUpdateProductPDF((*source).PdfList[l])
			}
		}
		ozonCreateOrUpdateProductItem.Price = (*source).Price
		ozonCreateOrUpdateProductItem.ServiceType = (*source).ServiceType
		ozonCreateOrUpdateProductItem.TypeId = (*source).TypeId
		ozonCreateOrUpdateProductItem.VAT = ozon.VAT((*source).Vat)
		ozonCreateOrUpdateProductItem.Weight = mapping.Int64ToInt32((*source).Weight)
		ozonCreateOrUpdateProductItem.WeightUnit = (*source).WeightUnit
		ozonCreateOrUpdateProductItem.Width = mapping.Int64ToInt32((*source).Width)
		pOzonCreateOrUpdateProductItem = &ozonCreateOrUpdateProductItem
	}
	return pOzonCreateOrUpdateProductItem
}
func (c *ConverterImpl) ToProto(source *ozon.ProductDetails) *products.Product {
	var pProductsProduct *products.Product
	if source != nil {
		var productsProduct products.Product
		productsProduct.Id = (*source).Id
		productsProduct.OfferId = (*source).OfferId
		productsProduct.Stocks = c.ozonProductDetailStockToPProductsProduct_Stocks((*source).Stocks)
		if (*source).Barcodes != nil {
			productsProduct.Barcodes = make([]string, len((*source).Barcodes))
			for i := 0; i < len((*source).Barcodes); i++ {
				productsProduct.Barcodes[i] = (*source).Barcodes[i]
			}
		}
		productsProduct.Statuses = c.ozonProductDetailsStatusToPProductsProduct_Status((*source).Statuses)
		if (*source).Errors != nil {
			productsProduct.Errors = make([]*products.Product_Error, len((*source).Errors))
			for j := 0; j < len((*source).Errors); j++ {
				productsProduct.Errors[j] = c.ozonProductDetailsErrorToPProductsProduct_Error((*source).Errors[j])
			}
		}
		pProductsProduct = &productsProduct
	}
	return pProductsProduct
}
func (c *ConverterImpl) ozonGetDescriptionOfProductsAttributeToPProductsProductAttributes_Attributes(source ozon.GetDescriptionOfProductsAttribute) *products.ProductAttributes_Attributes {
	var productsProductAttributes_Attributes products.ProductAttributes_Attributes
	productsProductAttributes_Attributes.Id = source.Id
	productsProductAttributes_Attributes.ComplexId = source.ComplexId
	if source.Values != nil {
		productsProductAttributes_Attributes.Values = make([]*products.ProductAttributes_Values, len(source.Values))
		for i := 0; i < len(source.Values); i++ {
			productsProductAttributes_Attributes.Values[i] = c.ozonGetDescriptionOfProductsAttributeValueToPProductsProductAttributes_Values(source.Values[i])
		}
	}
	return &productsProductAttributes_Attributes
}
func (c *ConverterImpl) ozonGetDescriptionOfProductsAttributeValueToPProductsProductAttributes_Values(source ozon.GetDescriptionOfProductsAttributeValue) *products.ProductAttributes_Values {
	var productsProductAttributes_Values products.ProductAttributes_Values
	productsProductAttributes_Values.DictionaryValueId = source.DictionaryValueId
	productsProductAttributes_Values.Value = source.Value
	return &productsProductAttributes_Values
}
func (c *ConverterImpl) ozonProductDetailStockStockToPProductsProduct_Stock(source ozon.ProductDetailStockStock) *products.Product_Stock {
	var productsProduct_Stock products.Product_Stock
	productsProduct_Stock.Present = mapping.Int32ToInt64(source.Present)
	productsProduct_Stock.Reserved = mapping.Int32ToInt64(source.Reserved)
	productsProduct_Stock.SKU = source.SKU
	productsProduct_Stock.Source = source.Source
	return &productsProduct_Stock
}
func (c *ConverterImpl) ozonProductDetailStockToPProductsProduct_Stocks(source ozon.ProductDetailStock) *products.Product_Stocks {
	var productsProduct_Stocks products.Product_Stocks
	if source.Stocks != nil {
		productsProduct_Stocks.Stocks = make([]*products.Product_Stock, len(source.Stocks))
		for i := 0; i < len(source.Stocks); i++ {
			productsProduct_Stocks.Stocks[i] = c.ozonProductDetailStockStockToPProductsProduct_Stock(source.Stocks[i])
		}
	}
	productsProduct_Stocks.HasStock = source.HasStock
	return &productsProduct_Stocks
}
func (c *ConverterImpl) ozonProductDetailsErrorToPProductsProduct_Error(source ozon.ProductDetailsError) *products.Product_Error {
	var productsProduct_Error products.Product_Error
	productsProduct_Error.Code = source.Code
	return &productsProduct_Error
}
func (c *ConverterImpl) ozonProductDetailsStatusToPProductsProduct_Status(source ozon.ProductDetailsStatus) *products.Product_Status {
	var productsProduct_Status products.Product_Status
	productsProduct_Status.StatusName = source.StatusName
	return &productsProduct_Status
}
func (c *ConverterImpl) pOzonModelInfoToPProductsProductAttributes_ModelInfo(source *ozon.ModelInfo) *products.ProductAttributes_ModelInfo {
	var pProductsProductAttributes_ModelInfo *products.ProductAttributes_ModelInfo
	if source != nil {
		var productsProductAttributes_ModelInfo products.ProductAttributes_ModelInfo
		productsProductAttributes_ModelInfo.ModelId = (*source).ModelId
		productsProductAttributes_ModelInfo.Count = (*source).Count
		pProductsProductAttributes_ModelInfo = &productsProductAttributes_ModelInfo
	}
	return pProductsProductAttributes_ModelInfo
}
func (c *ConverterImpl) pProductsCreateOrUpdateProductsRequest_Item_AttributesToOzonCreateOrUpdateAttribute(source *products.CreateOrUpdateProductsRequest_Item_Attributes) ozon.CreateOrUpdateAttribute {
	var ozonCreateOrUpdateAttribute ozon.CreateOrUpdateAttribute
	if source != nil {
		var ozonCreateOrUpdateAttribute2 ozon.CreateOrUpdateAttribute
		ozonCreateOrUpdateAttribute2.ComplexId = (*source).ComplexId
		ozonCreateOrUpdateAttribute2.Id = (*source).Id
		if (*source).Values != nil {
			ozonCreateOrUpdateAttribute2.Values = make([]ozon.CreateOrUpdateAttributeValue, len((*source).Values))
			for i := 0; i < len((*source).Values); i++ {
				ozonCreateOrUpdateAttribute2.Values[i] = c.pProductsCreateOrUpdateProductsRequest_Item_ValuesToOzonCreateOrUpdateAttributeValue((*source).Values[i])
			}
		}
		ozonCreateOrUpdateAttribute = ozonCreateOrUpdateAttribute2
	}
	return ozonCreateOrUpdateAttribute
}
func (c *ConverterImpl) pProductsCreateOrUpdateProductsRequest_Item_PdfListItemToOzonCreateOrUpdateProductPDF(source *products.CreateOrUpdateProductsRequest_Item_PdfListItem) ozon.CreateOrUpdateProductPDF {
	var ozonCreateOrUpdateProductPDF ozon.CreateOrUpdateProductPDF
	if source != nil {
		var ozonCreateOrUpdateProductPDF2 ozon.CreateOrUpdateProductPDF
		ozonCreateOrUpdateProductPDF2.Index = (*source).Index
		ozonCreateOrUpdateProductPDF2.Name = (*source).Name
		ozonCreateOrUpdateProductPDF2.SrcUrl = (*source).SrcUrl
		ozonCreateOrUpdateProductPDF = ozonCreateOrUpdateProductPDF2
	}
	return ozonCreateOrUpdateProductPDF
}
func (c *ConverterImpl) pProductsCreateOrUpdateProductsRequest_Item_ValuesToOzonCreateOrUpdateAttributeValue(source *products.CreateOrUpdateProductsRequest_Item_Values) ozon.CreateOrUpdateAttributeValue {
	var ozonCreateOrUpdateAttributeValue ozon.CreateOrUpdateAttributeValue
	if source != nil {
		var ozonCreateOrUpdateAttributeValue2 ozon.CreateOrUpdateAttributeValue
		ozonCreateOrUpdateAttributeValue2.DictionaryValueId = (*source).DictionaryValueId
		ozonCreateOrUpdateAttributeValue2.Value = (*source).Value
		ozonCreateOrUpdateAttributeValue = ozonCreateOrUpdateAttributeValue2
	}
	return ozonCreateOrUpdateAttributeValue
}
