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

package generated

import (
	yandexgoclient "git.denco.store/fakz9/yandex-go-client"
	products "sipro-mps/api/generated/v1/yandexmarket/products"
	mapping "sipro-mps/internal/ym/products/mapping"
)

type ConverterImpl struct{}

func (c *ConverterImpl) ProtoOfferToYmOffer(source *products.CalculateProductTariffsRequest_Offer) *yandexgoclient.CalculateTariffsOfferDTO {
	var pYmclientCalculateTariffsOfferDTO *yandexgoclient.CalculateTariffsOfferDTO
	if source != nil {
		var ymclientCalculateTariffsOfferDTO yandexgoclient.CalculateTariffsOfferDTO
		ymclientCalculateTariffsOfferDTO.CategoryId = (*source).CategoryId
		ymclientCalculateTariffsOfferDTO.Price = (*source).Price
		ymclientCalculateTariffsOfferDTO.Length = (*source).Length
		ymclientCalculateTariffsOfferDTO.Width = (*source).Width
		ymclientCalculateTariffsOfferDTO.Height = (*source).Height
		ymclientCalculateTariffsOfferDTO.Weight = (*source).Weight
		pInt32 := mapping.Int64ToInt32((*source).Quantity)
		ymclientCalculateTariffsOfferDTO.Quantity = &pInt32
		pYmclientCalculateTariffsOfferDTO = &ymclientCalculateTariffsOfferDTO
	}
	return pYmclientCalculateTariffsOfferDTO
}
func (c *ConverterImpl) ProtoParametersToYmParameters(source *products.CalculateProductTariffsRequest_Parameters) *yandexgoclient.CalculateTariffsParametersDTO {
	var pYmclientCalculateTariffsParametersDTO *yandexgoclient.CalculateTariffsParametersDTO
	if source != nil {
		var ymclientCalculateTariffsParametersDTO yandexgoclient.CalculateTariffsParametersDTO
		pInt64 := (*source).CampaignId
		ymclientCalculateTariffsParametersDTO.CampaignId = &pInt64
		pYmclientSellingProgramType := yandexgoclient.SellingProgramType((*source).SellingProgram)
		ymclientCalculateTariffsParametersDTO.SellingProgram = &pYmclientSellingProgramType
		pYmclientPaymentFrequencyType := yandexgoclient.PaymentFrequencyType((*source).Frequency)
		ymclientCalculateTariffsParametersDTO.Frequency = &pYmclientPaymentFrequencyType
		pYmclientCurrencyType := yandexgoclient.CurrencyType((*source).Currency)
		ymclientCalculateTariffsParametersDTO.Currency = &pYmclientCurrencyType
		pYmclientCalculateTariffsParametersDTO = &ymclientCalculateTariffsParametersDTO
	}
	return pYmclientCalculateTariffsParametersDTO
}
func (c *ConverterImpl) YmOfferToProtoOffer(source *yandexgoclient.GetOfferDTO) *products.GetProductsResponse_Offer {
	var pProductsGetProductsResponse_Offer *products.GetProductsResponse_Offer
	if source != nil {
		var productsGetProductsResponse_Offer products.GetProductsResponse_Offer
		if (*source).MarketCategoryId != nil {
			productsGetProductsResponse_Offer.MarketCategoryId = *(*source).MarketCategoryId
		}
		productsGetProductsResponse_Offer.WeightDimensions = c.pYmclientOfferWeightDimensionsDTOToPProductsGetProductsResponse_Offer_WeightDimensions((*source).WeightDimensions)
		productsGetProductsResponse_Offer.BasicPrice = c.pYmclientGetPriceWithDiscountDTOToPProductsGetProductsResponse_Offer_BasicPrice((*source).BasicPrice)
		productsGetProductsResponse_Offer.OfferId = (*source).OfferId
		pProductsGetProductsResponse_Offer = &productsGetProductsResponse_Offer
	}
	return pProductsGetProductsResponse_Offer
}
func (c *ConverterImpl) YmOfferToProtoResponseOffer(source *yandexgoclient.CalculateTariffsOfferInfoDTO) *products.CalculateProductTariffsResponse_Offers {
	var pProductsCalculateProductTariffsResponse_Offers *products.CalculateProductTariffsResponse_Offers
	if source != nil {
		var productsCalculateProductTariffsResponse_Offers products.CalculateProductTariffsResponse_Offers
		productsCalculateProductTariffsResponse_Offers.Offer = c.ymclientCalculateTariffsOfferDTOToPProductsCalculateProductTariffsResponse_Offer((*source).Offer)
		if (*source).Tariffs != nil {
			productsCalculateProductTariffsResponse_Offers.Tariffs = make([]*products.CalculateProductTariffsResponse_Tariff, len((*source).Tariffs))
			for i := 0; i < len((*source).Tariffs); i++ {
				productsCalculateProductTariffsResponse_Offers.Tariffs[i] = c.ymclientCalculatedTariffDTOToPProductsCalculateProductTariffsResponse_Tariff((*source).Tariffs[i])
			}
		}
		pProductsCalculateProductTariffsResponse_Offers = &productsCalculateProductTariffsResponse_Offers
	}
	return pProductsCalculateProductTariffsResponse_Offers
}
func (c *ConverterImpl) YmTariffToProtoTariff(source *yandexgoclient.CalculatedTariffDTO) *products.CalculateProductTariffsResponse_Tariff {
	var pProductsCalculateProductTariffsResponse_Tariff *products.CalculateProductTariffsResponse_Tariff
	if source != nil {
		var productsCalculateProductTariffsResponse_Tariff products.CalculateProductTariffsResponse_Tariff
		productsCalculateProductTariffsResponse_Tariff.Type = string((*source).Type)
		if (*source).Amount != nil {
			productsCalculateProductTariffsResponse_Tariff.Amount = mapping.Float32ToInt64(*(*source).Amount)
		}
		if (*source).Currency != nil {
			productsCalculateProductTariffsResponse_Tariff.Currency = string(*(*source).Currency)
		}
		if (*source).Parameters != nil {
			productsCalculateProductTariffsResponse_Tariff.Parameters = make([]*products.CalculateProductTariffsResponse_Parameter, len((*source).Parameters))
			for i := 0; i < len((*source).Parameters); i++ {
				productsCalculateProductTariffsResponse_Tariff.Parameters[i] = c.ymclientTariffParameterDTOToPProductsCalculateProductTariffsResponse_Parameter((*source).Parameters[i])
			}
		}
		pProductsCalculateProductTariffsResponse_Tariff = &productsCalculateProductTariffsResponse_Tariff
	}
	return pProductsCalculateProductTariffsResponse_Tariff
}
func (c *ConverterImpl) pYmclientGetPriceWithDiscountDTOToPProductsGetProductsResponse_Offer_BasicPrice(source *yandexgoclient.GetPriceWithDiscountDTO) *products.GetProductsResponse_Offer_BasicPrice {
	var pProductsGetProductsResponse_Offer_BasicPrice *products.GetProductsResponse_Offer_BasicPrice
	if source != nil {
		var productsGetProductsResponse_Offer_BasicPrice products.GetProductsResponse_Offer_BasicPrice
		productsGetProductsResponse_Offer_BasicPrice.Value = (*source).Value
		pProductsGetProductsResponse_Offer_BasicPrice = &productsGetProductsResponse_Offer_BasicPrice
	}
	return pProductsGetProductsResponse_Offer_BasicPrice
}
func (c *ConverterImpl) pYmclientOfferWeightDimensionsDTOToPProductsGetProductsResponse_Offer_WeightDimensions(source *yandexgoclient.OfferWeightDimensionsDTO) *products.GetProductsResponse_Offer_WeightDimensions {
	var pProductsGetProductsResponse_Offer_WeightDimensions *products.GetProductsResponse_Offer_WeightDimensions
	if source != nil {
		var productsGetProductsResponse_Offer_WeightDimensions products.GetProductsResponse_Offer_WeightDimensions
		productsGetProductsResponse_Offer_WeightDimensions.Length = (*source).Length
		productsGetProductsResponse_Offer_WeightDimensions.Width = (*source).Width
		productsGetProductsResponse_Offer_WeightDimensions.Height = (*source).Height
		productsGetProductsResponse_Offer_WeightDimensions.Weight = (*source).Weight
		pProductsGetProductsResponse_Offer_WeightDimensions = &productsGetProductsResponse_Offer_WeightDimensions
	}
	return pProductsGetProductsResponse_Offer_WeightDimensions
}
func (c *ConverterImpl) ymclientCalculateTariffsOfferDTOToPProductsCalculateProductTariffsResponse_Offer(source yandexgoclient.CalculateTariffsOfferDTO) *products.CalculateProductTariffsResponse_Offer {
	var productsCalculateProductTariffsResponse_Offer products.CalculateProductTariffsResponse_Offer
	productsCalculateProductTariffsResponse_Offer.CategoryId = source.CategoryId
	productsCalculateProductTariffsResponse_Offer.Price = source.Price
	productsCalculateProductTariffsResponse_Offer.Length = source.Length
	productsCalculateProductTariffsResponse_Offer.Width = source.Width
	productsCalculateProductTariffsResponse_Offer.Height = source.Height
	productsCalculateProductTariffsResponse_Offer.Weight = source.Weight
	if source.Quantity != nil {
		productsCalculateProductTariffsResponse_Offer.Quantity = mapping.Int32ToInt64(*source.Quantity)
	}
	return &productsCalculateProductTariffsResponse_Offer
}
func (c *ConverterImpl) ymclientCalculatedTariffDTOToPProductsCalculateProductTariffsResponse_Tariff(source yandexgoclient.CalculatedTariffDTO) *products.CalculateProductTariffsResponse_Tariff {
	var productsCalculateProductTariffsResponse_Tariff products.CalculateProductTariffsResponse_Tariff
	productsCalculateProductTariffsResponse_Tariff.Type = string(source.Type)
	if source.Amount != nil {
		productsCalculateProductTariffsResponse_Tariff.Amount = mapping.Float32ToInt64(*source.Amount)
	}
	if source.Currency != nil {
		productsCalculateProductTariffsResponse_Tariff.Currency = string(*source.Currency)
	}
	if source.Parameters != nil {
		productsCalculateProductTariffsResponse_Tariff.Parameters = make([]*products.CalculateProductTariffsResponse_Parameter, len(source.Parameters))
		for i := 0; i < len(source.Parameters); i++ {
			productsCalculateProductTariffsResponse_Tariff.Parameters[i] = c.ymclientTariffParameterDTOToPProductsCalculateProductTariffsResponse_Parameter(source.Parameters[i])
		}
	}
	return &productsCalculateProductTariffsResponse_Tariff
}
func (c *ConverterImpl) ymclientTariffParameterDTOToPProductsCalculateProductTariffsResponse_Parameter(source yandexgoclient.TariffParameterDTO) *products.CalculateProductTariffsResponse_Parameter {
	var productsCalculateProductTariffsResponse_Parameter products.CalculateProductTariffsResponse_Parameter
	productsCalculateProductTariffsResponse_Parameter.Name = source.Name
	productsCalculateProductTariffsResponse_Parameter.Value = source.Value
	return &productsCalculateProductTariffsResponse_Parameter
}
