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

package generated

import (
	jx "github.com/go-faster/jx"
	products "sipro-mps/api/generated/v1/wb/products"
	mapping "sipro-mps/internal/wb/products/mapping"
	client "sipro-mps/pkg/api/wb/client"
)

type ConverterImpl struct{}

func (c *ConverterImpl) ToProto(source *client.ContentV2GetCardsListPostOKCardsItem) *products.Product {
	var pProductsProduct *products.Product
	if source != nil {
		var productsProduct products.Product
		productsProduct.NmID = mapping.OptIntToInt64((*source).NmID)
		productsProduct.SubjectID = mapping.OptIntToInt64((*source).SubjectID)
		productsProduct.VendorCode = mapping.OptStringToString((*source).VendorCode)
		if (*source).Sizes != nil {
			productsProduct.Sizes = make([]*products.Product_Size, len((*source).Sizes))
			for i := 0; i < len((*source).Sizes); i++ {
				productsProduct.Sizes[i] = c.apiContentV2GetCardsListPostOKCardsItemSizesItemToPProductsProduct_Size((*source).Sizes[i])
			}
		}
		if (*source).Characteristics != nil {
			productsProduct.Characteristics = make([]*products.Product_Characteristic, len((*source).Characteristics))
			for j := 0; j < len((*source).Characteristics); j++ {
				productsProduct.Characteristics[j] = c.apiContentV2GetCardsListPostOKCardsItemCharacteristicsItemToPProductsProduct_Characteristic((*source).Characteristics[j])
			}
		}
		if (*source).Photos != nil {
			productsProduct.Photos = make([]*products.Product_Photo, len((*source).Photos))
			for k := 0; k < len((*source).Photos); k++ {
				productsProduct.Photos[k] = c.apiContentV2GetCardsListPostOKCardsItemPhotosItemToPProductsProduct_Photo((*source).Photos[k])
			}
		}
		productsProduct.Dimensions = mapping.WbDimensionsToProto((*source).Dimensions)
		productsProduct.Title = mapping.OptStringToString((*source).Title)
		pProductsProduct = &productsProduct
	}
	return pProductsProduct
}
func (c *ConverterImpl) apiContentV2GetCardsListPostOKCardsItemCharacteristicsItemToPProductsProduct_Characteristic(source client.ContentV2GetCardsListPostOKCardsItemCharacteristicsItem) *products.Product_Characteristic {
	var productsProduct_Characteristic products.Product_Characteristic
	productsProduct_Characteristic.Id = mapping.OptIntToInt64(source.ID)
	productsProduct_Characteristic.Name = mapping.OptStringToString(source.Name)
	productsProduct_Characteristic.Value = c.jxRawToByteList(source.Value)
	return &productsProduct_Characteristic
}
func (c *ConverterImpl) apiContentV2GetCardsListPostOKCardsItemPhotosItemToPProductsProduct_Photo(source client.ContentV2GetCardsListPostOKCardsItemPhotosItem) *products.Product_Photo {
	var productsProduct_Photo products.Product_Photo
	productsProduct_Photo.Big = mapping.OptStringToString(source.Big)
	return &productsProduct_Photo
}
func (c *ConverterImpl) apiContentV2GetCardsListPostOKCardsItemSizesItemToPProductsProduct_Size(source client.ContentV2GetCardsListPostOKCardsItemSizesItem) *products.Product_Size {
	var productsProduct_Size products.Product_Size
	if source.Skus != nil {
		productsProduct_Size.Skus = make([]string, len(source.Skus))
		for i := 0; i < len(source.Skus); i++ {
			productsProduct_Size.Skus[i] = source.Skus[i]
		}
	}
	productsProduct_Size.ChrtID = mapping.OptIntToInt64(source.ChrtID)
	productsProduct_Size.TechSize = mapping.OptStringToString(source.TechSize)
	productsProduct_Size.WbSize = mapping.OptStringToString(source.WbSize)
	return &productsProduct_Size
}
func (c *ConverterImpl) jxRawToByteList(source jx.Raw) []uint8 {
	var byteList []uint8
	if source != nil {
		byteList = make([]uint8, len(source))
		for i := 0; i < len(source); i++ {
			byteList[i] = source[i]
		}
	}
	return byteList
}
