package transfer_intent_hydrator

import paymenttypes "github.com/tech/sendico/pkg/payments/types"

type QuoteIntentKind string

const (
	QuoteIntentKindUnspecified      QuoteIntentKind = "unspecified"
	QuoteIntentKindPayout           QuoteIntentKind = "payout"
	QuoteIntentKindInternalTransfer QuoteIntentKind = "internal_transfer"
	QuoteIntentKindFXConversion     QuoteIntentKind = "fx_conversion"
)

type QuoteSettlementMode string

const (
	QuoteSettlementModeUnspecified QuoteSettlementMode = "unspecified"
	QuoteSettlementModeFixSource   QuoteSettlementMode = "fix_source"
	QuoteSettlementModeFixReceived QuoteSettlementMode = "fix_received"
)

type QuoteFeeTreatment string

const (
	QuoteFeeTreatmentUnspecified           QuoteFeeTreatment = "unspecified"
	QuoteFeeTreatmentAddToSource           QuoteFeeTreatment = "add_to_source"
	QuoteFeeTreatmentDeductFromDestination QuoteFeeTreatment = "deduct_from_destination"
)

type QuoteEndpointType string

const (
	QuoteEndpointTypeUnspecified   QuoteEndpointType = "unspecified"
	QuoteEndpointTypeLedger        QuoteEndpointType = "ledger"
	QuoteEndpointTypeManagedWallet QuoteEndpointType = "managed_wallet"
	QuoteEndpointTypeExternalChain QuoteEndpointType = "external_chain"
	QuoteEndpointTypeCard          QuoteEndpointType = "card"
)

type QuoteLedgerEndpoint struct {
	LedgerAccountRef       string
	ContraLedgerAccountRef string
}

type QuoteManagedWalletEndpoint struct {
	ManagedWalletRef string
	Asset            *paymenttypes.Asset
}

type QuoteExternalChainEndpoint struct {
	Asset   *paymenttypes.Asset
	Address string
	Memo    string
}

type QuoteCardEndpoint struct {
	Pan               string
	Token             string
	Cardholder        string
	CardholderSurname string
	ExpMonth          uint32
	ExpYear           uint32
	Country           string
	MaskedPan         string
}

type QuoteFXIntent struct {
	Pair              *paymenttypes.CurrencyPair
	Side              paymenttypes.FXSide
	Firm              bool
	TTLms             int64
	PreferredProvider string
	MaxAgeMs          int32
}

type QuoteEndpoint struct {
	Type             QuoteEndpointType
	PaymentMethodRef string
	PayeeRef         string

	Ledger        *QuoteLedgerEndpoint
	ManagedWallet *QuoteManagedWalletEndpoint
	ExternalChain *QuoteExternalChainEndpoint
	Card          *QuoteCardEndpoint
}

type QuoteIntent struct {
	Ref                string
	Kind               QuoteIntentKind
	Source             QuoteEndpoint
	Destination        QuoteEndpoint
	Amount             *paymenttypes.Money
	Comment            string
	SettlementMode     QuoteSettlementMode
	FeeTreatment       QuoteFeeTreatment
	FX                 *QuoteFXIntent
	SettlementCurrency string
	RequiresFX         bool
	Attributes         map[string]string
}
