export const TX_KEY_MAP: Record<string, string> = {
  MANUAL_DEPOSIT: 'wallet.tx_deposit',
  MANUAL_WITHDRAW: 'wallet.tx_withdraw',
  MANUAL_ADJUST: 'wallet.tx_adjust',
  BET_FREEZE: 'wallet.tx_bet_freeze',
  BET_DEDUCT: 'wallet.tx_bet_deduct',
  BET_SETTLE_WIN: 'wallet.tx_bet_win',
  BET_SETTLE_LOSE: 'wallet.tx_bet_lose',
  BET_SETTLE_PUSH: 'wallet.tx_bet_push',
  BET_WIN: 'wallet.tx_bet_win',
  BET_REFUND: 'wallet.tx_bet_refund',
  BET_VOID: 'wallet.tx_bet_void',
  BET_VOID_REFUND: 'wallet.tx_bet_void',
  CASHBACK: 'wallet.tx_cashback',
  CASHBACK_DEPOSIT: 'wallet.tx_cashback',
  RESETTLE_REVERSE: 'wallet.tx_resettle',
  DEPOSIT: 'wallet.tx_deposit',
  WITHDRAW: 'wallet.tx_withdraw',
};

export function txTypeKey(type: string): string {
  return TX_KEY_MAP[type.toUpperCase()] ?? '';
}

export function isDepositType(type: string): boolean {
  const t = type.toUpperCase();
  return (t.includes('DEPOSIT') || t === 'CASHBACK_DEPOSIT') && !isCashbackType(type);
}

export function isWithdrawType(type: string): boolean {
  return type.toUpperCase().includes('WITHDRAW');
}

export function isBetType(type: string): boolean {
  return type.toUpperCase().startsWith('BET_') || type.toUpperCase() === 'RESETTLE_REVERSE';
}

export function isCashbackType(type: string): boolean {
  const t = type.toUpperCase();
  return t === 'CASHBACK' || t === 'CASHBACK_DEPOSIT';
}
