export type BillType = 'lease' | 'self-operated' | 'clearing';

export interface LinkedBill {
  id: string;
  type: BillType;
  label: string;
  allocatedAmount: number;
  period?: string;
  customerName?: string;
  projectName?: string;
  contractCode?: string;
}

export interface EnrichedLinkedBill extends LinkedBill {
  receivable?: number;
}

export interface PaymentRecord {
  id: string;
  paymentTime: string;
  customerName: string;
  companyEntity: string;
  bank: string;
  amount: number;
  remark: string;
  linkedBills: LinkedBill[];
  operatorName: string;
  operatedAt: string;
}

export interface BillCandidate {
  id: string;
  type: BillType;
  customerName: string;
  projectName: string;
  contractCode: string;
  label: string;
  period: string;
  receivable: number;
  unreceived: number;
}

export interface PaymentRecordFilters {
  customerName: string;
  companyEntity: string;
  bank: string;
  paymentFrom: string;
  paymentTo: string;
  operatorName: string;
  unclaimed: '' | 'yes' | 'no';
}

export const EMPTY_PAYMENT_FILTERS: PaymentRecordFilters = {
  customerName: '',
  companyEntity: '',
  bank: '',
  paymentFrom: '',
  paymentTo: '',
  operatorName: '',
  unclaimed: '',
};

export interface PaymentKpiDetailFilters {
  customerName: string;
  paymentFrom: string;
  paymentTo: string;
  billType: '' | BillType;
}

export const EMPTY_PAYMENT_KPI_DETAIL_FILTERS: PaymentKpiDetailFilters = {
  customerName: '',
  paymentFrom: '',
  paymentTo: '',
  billType: '',
};

export const BILL_TYPE_LABELS: Record<BillType, string> = {
  lease: '租赁账单',
  'self-operated': '自营账单',
  clearing: '氢费账单',
};
