/**
 * Wording for the withdraw request actions, shared by the list and the details page. The server
 * (WithdrawRequestService::update) decides which apply; these only describe them.
 */
export type WithdrawAction = 'approved' | 'denied' | 'settled' | 'reverse';

export const withdrawActionLabels: Record<WithdrawAction, string> = {
    approved: 'Approve',
    denied: 'Deny',
    settled: 'Settle',
    reverse: 'Reverse to pending',
};

export function withdrawActionDialog(action: WithdrawAction, subject: string) {
    switch (action) {
        case 'approved':
            return { title: 'Approve the withdrawal?', message: `${subject} is approved for payment. Settle it once the money is sent.`, confirmLabel: 'Approve', tone: 'primary' as const, note: 'approval_note', noteLabel: 'Approval note' };
        case 'denied':
            return { title: 'Deny the withdrawal?', message: `${subject} is denied and the amount goes back to the driver's balance. The note is sent to the driver.`, confirmLabel: 'Deny', tone: 'danger' as const, note: 'denied_note', noteLabel: 'Reason for the driver' };
        case 'settled':
            return { title: 'Mark as settled?', message: `${subject} is recorded as paid out to the driver.`, confirmLabel: 'Settle', tone: 'primary' as const, note: null, noteLabel: null };
        case 'reverse':
            return { title: 'Reverse to pending?', message: `${subject} goes back to pending and any balance change from its last status is undone.`, confirmLabel: 'Reverse', tone: 'danger' as const, note: null, noteLabel: null };
    }
}
