/**
 * 财务相关常量定义
 */

import type { SettlementStatus, WithdrawalStatus, TransactionType } from './finance';

// 结算单状态映射
export const SETTLEMENT_STATUS_MAP: Record<SettlementStatus, { label: string; color: string }> = {
  pending: { label: '待审核', color: 'orange' },
  approved: { label: '已通过', color: 'blue' },
  rejected: { label: '已拒绝', color: 'red' },
  paid: { label: '已打款', color: 'green' },
};

// 提现状态映射
export const WITHDRAWAL_STATUS_MAP: Record<WithdrawalStatus, { label: string; color: string }> = {
  pending: { label: '待审核', color: 'orange' },
  approved: { label: '已通过', color: 'blue' },
  rejected: { label: '已拒绝', color: 'red' },
  completed: { label: '已完成', color: 'green' },
  failed: { label: '失败', color: 'red' },
};

// 交易类型映射
export const TRANSACTION_TYPE_MAP: Record<TransactionType, { label: string; sign: '+' | '-' }> = {
  order_income: { label: '订单收入', sign: '+' },
  settlement_freeze: { label: '结算冻结', sign: '-' },
  settlement_income: { label: '结算收入', sign: '+' },
  withdrawal_freeze: { label: '提现冻结', sign: '-' },
  withdrawal_expense: { label: '提现支出', sign: '-' },
  withdrawal_refund: { label: '提现退回', sign: '+' },
  refund_expense: { label: '退款支出', sign: '-' },
  cashback_income: { label: '返现收入', sign: '+' },
  service_fee: { label: '服务费', sign: '-' },
};

// 结算单状态选项（用于筛选）
export const SETTLEMENT_STATUS_OPTIONS = [
  { label: '全部', value: '' },
  { label: '待审核', value: 'pending' },
  { label: '已通过', value: 'approved' },
  { label: '已拒绝', value: 'rejected' },
  { label: '已打款', value: 'paid' },
];

// 提现状态选项（用于筛选）
export const WITHDRAWAL_STATUS_OPTIONS = [
  { label: '全部', value: '' },
  { label: '待审核', value: 'pending' },
  { label: '已通过', value: 'approved' },
  { label: '已拒绝', value: 'rejected' },
  { label: '已完成', value: 'completed' },
  { label: '失败', value: 'failed' },
];

// 交易类型选项（用于筛选）
export const TRANSACTION_TYPE_OPTIONS = [
  { label: '全部', value: '' },
  { label: '订单收入', value: 'order_income' },
  { label: '结算收入', value: 'settlement_income' },
  { label: '提现支出', value: 'withdrawal_expense' },
  { label: '退款支出', value: 'refund_expense' },
  { label: '返现收入', value: 'cashback_income' },
];

// 默认分页配置
export const DEFAULT_PAGE_SIZE = 10;
export const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];

// 提现手续费率
export const WITHDRAWAL_FEE_RATE = 0.006; // 0.6%
export const MIN_WITHDRAWAL_AMOUNT = 1; // 最小提现金额 1元
export const MAX_WITHDRAWAL_AMOUNT = 50000; // 最大提现金额 5万元

// 服务费率
export const SERVICE_FEE_RATE = 0.05; // 5%

// 结算周期（天）
export const SETTLEMENT_PERIOD_DAYS = 7; // 7天一个结算周期
