package dto_astrologer

// WithdrawSummaryLineResponse is one row of the Summary card — a label, a
// formatted amount and how it should be read. The app renders the lines in
// order instead of knowing which deductions exist, so adding a charge later
// does not need an app release.
type WithdrawSummaryLineResponse struct {
	Label string  `json:"label"`
	Value float64 `json:"value"`

	// CREDIT, DEBIT or TOTAL. TOTAL is the highlighted "You receive" row.
	Kind string `json:"kind"`
}

// WithdrawPreviewResponse is the Summary card on the withdraw screen: what is
// deducted and what lands in the account, computed server-side so the app
// never has to know the fee rules.
//
// It is also embedded in the create response, so the confirmation shows
// exactly the figures that were stored on the request.
type WithdrawPreviewResponse struct {
	WithdrawType  string  `json:"withdrawType"`
	PaymentMethod string  `json:"paymentMethod"`
	Amount        float64 `json:"amount"`

	TDSPercent    float64 `json:"tdsPercent"`
	TDSAmount     float64 `json:"tdsAmount"`
	InstantCharge float64 `json:"instantCharge"`

	// TDSAmount + InstantCharge — the "Processing fee" line.
	TotalDeduction float64 `json:"totalDeduction"`

	// Amount - TotalDeduction — the "You receive" line.
	NetAmount float64 `json:"netAmount"`

	// Wallet balance once the request goes through.
	BalanceAfter float64 `json:"balanceAfter"`

	PayoutTo string `json:"payoutTo"`
	BankName string `json:"bankName,omitempty"`

	Lines []WithdrawSummaryLineResponse `json:"lines"`
	Note  string                        `json:"note"`
}

// WithdrawCreateResponse is returned once the request is written: the stored
// request plus the breakdown it was created with and the new wallet balance.
type WithdrawCreateResponse struct {
	Withdraw  WithdrawResponse        `json:"withdraw"`
	Breakdown WithdrawPreviewResponse `json:"breakdown"`

	AvailableBalance float64 `json:"availableBalance"`
	Message          string  `json:"message"`
}
