package dto_astrologer

// WithdrawPayoutMethodResponse is one of the two tabs on the withdraw screen —
// the astrologer's saved UPI and their saved bank account. A method the
// astrologer has not saved comes back with IsAvailable false and a Reason,
// rather than being omitted, so the app can still render the tab greyed out.
type WithdrawPayoutMethodResponse struct {
	Method    string `json:"method"`
	Label     string `json:"label"`
	Title     string `json:"title"`
	Subtitle  string `json:"subtitle"`
	MaskedRef string `json:"maskedRef"`

	BankName          string `json:"bankName,omitempty"`
	AccountHolderName string `json:"accountHolderName,omitempty"`

	VerificationStatus string `json:"verificationStatus,omitempty"`
	IsAvailable        bool   `json:"isAvailable"`
	IsDefault          bool   `json:"isDefault"`
	Reason             string `json:"reason,omitempty"`
}

// WithdrawTypeOptionResponse describes one of the two withdraw types with the
// charges that apply to it, so the app never has to hardcode a fee.
type WithdrawTypeOptionResponse struct {
	Type        string  `json:"type"`
	Label       string  `json:"label"`
	Description string  `json:"description"`
	MinAmount   float64 `json:"minAmount"`

	// 0 means no ceiling beyond the available balance.
	MaxAmount float64 `json:"maxAmount"`

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

	IsAvailable bool   `json:"isAvailable"`
	Reason      string `json:"reason,omitempty"`
}

// WithdrawConfigResponse is everything the withdraw screen needs before the
// astrologer types an amount: the balance, the limits, the fees in force and
// the payout methods on file.
type WithdrawConfigResponse struct {
	AvailableBalance float64 `json:"availableBalance"`

	MinAmount float64 `json:"minAmount"`

	// The "Maximum ₹18,450 today" line — the available balance, or 0 when
	// there is nothing to withdraw.
	MaxAmount float64 `json:"maxAmount"`

	// Shortcut chips on the amount card. Amounts above the balance are
	// dropped, so the app can render whatever it is given.
	QuickAmounts []float64 `json:"quickAmounts"`

	Types   []WithdrawTypeOptionResponse   `json:"types"`
	Methods []WithdrawPayoutMethodResponse `json:"methods"`

	// A general request already awaiting approval blocks another one. The app
	// uses this to disable the button and point at the open request.
	HasPendingRequest bool   `json:"hasPendingRequest"`
	PendingRequestID  uint   `json:"pendingRequestId,omitempty"`
	PendingMessage    string `json:"pendingMessage,omitempty"`

	Note string `json:"note"`
}
