import type { FinanceSettlementFilterState, OptionItem } from '../../types';

import type {
  FinanceSettlementAccountDto,
  FinanceSettlementChannelFilter,
  FinanceSettlementStatsDto,
} from '#/api/finance';

/**
 * 文件职责：到账查询页面常量与默认状态定义。
 */
import { getTodayDateString } from './helpers';

/** 到账查询查看权限。 */
export const FINANCE_SETTLEMENT_VIEW_PERMISSION =
  'tenant:finance:settlement:view';

/** 到账查询导出权限。 */
export const FINANCE_SETTLEMENT_EXPORT_PERMISSION =
  'tenant:finance:settlement:export';

/** 到账渠道筛选项。 */
export const SETTLEMENT_CHANNEL_OPTIONS: OptionItem[] = [
  { label: '全部渠道', value: 'all' },
  { label: '微信支付', value: 'wechat' },
  { label: '支付宝', value: 'alipay' },
];

/** 默认筛选状态。 */
export function createDefaultFilters(): FinanceSettlementFilterState {
  const today = getTodayDateString();
  return {
    channel: 'all' as FinanceSettlementChannelFilter,
    startDate: today,
    endDate: today,
  };
}

/** 默认统计数据。 */
export const DEFAULT_STATS: FinanceSettlementStatsDto = {
  todayArrivedAmount: 0,
  yesterdayArrivedAmount: 0,
  currentMonthArrivedAmount: 0,
  currentMonthTransactionCount: 0,
};

/** 默认账户信息。 */
export const DEFAULT_ACCOUNT: FinanceSettlementAccountDto = {
  bankName: '',
  bankAccountName: '',
  bankAccountNoMasked: '',
  wechatMerchantNoMasked: '',
  alipayPidMasked: '',
  settlementPeriodText: '',
};
