package mapping

import (
	proto "sipro-mps/api/generated/v1/yandexmarket/products"

	"git.denco.store/fakz9/yandex-go-client"
)

//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen .

// goverter:converter
// goverter:output:file ./generated/generated.go
// goverter:output:package generated
// goverter:ignoreUnexported yes
// goverter:matchIgnoreCase yes
// goverter:ignoreMissing yes
// goverter:useZeroValueOnPointerInconsistency yes
// goverter:extend Int64ToFloat32 Int64ToInt32 Float32ToInt64 Int32ToInt64 PointerInt32ToInt64
type Converter interface {
	ProtoOfferToYmOffer(details *proto.CalculateProductTariffsRequest_Offer) *ymclient.CalculateTariffsOfferDTO
	ProtoParametersToYmParameters(details *proto.CalculateProductTariffsRequest_Parameters) *ymclient.CalculateTariffsParametersDTO

	// Response converters
	YmOfferToProtoResponseOffer(details *ymclient.CalculateTariffsOfferInfoDTO) *proto.CalculateProductTariffsResponse_Offers
	YmTariffToProtoTariff(details *ymclient.CalculatedTariffDTO) *proto.CalculateProductTariffsResponse_Tariff

	YmOfferToProtoOffer(details *ymclient.GetOfferDTO) *proto.GetProductsResponse_Offer
}

func Int64ToFloat32(i int64) float32 {
	return float32(i)
}
func Int64ToInt32(i int64) int32 {
	return int32(i)
}
func Float32ToInt64(f float32) int64 {
	return int64(f)
}
func Int32ToInt64(i int32) int64 {
	return int64(i)
}
func PointerInt32ToInt64(i *int32) *int64 {
	if i == nil {
		return nil
	}
	val := int64(*i)
	return &val
}
