export type LeaseDetailStatus = '草稿' | '已确认' | '部分收款' | '已收款';
export type AssetOwnership = '自有' | '租赁' | '挂靠';
export type ListViewMode = 'all' | 'unpaid';

export interface LeaseLedgerRow {
  id: string;
  status: LeaseDetailStatus;
  maintainerName: string;
  year: number;
  month: number;
  dept: string;
  salesman: string;
  paymentDate: string;
  plateNo: string;
  vehicleBrand: string;
  vehicleModel: string;
  vehicleType?: string;
  customerName: string;
  projectName: string;
  valueAddedService: string;
  exemptionPolicy: string;
  pickupDate: string;
  contractStartDate: string;
  contractEndDate: string;
  periodStartDate: string;
  returnDate: string;
  avgDays: number;
  deposit: string | number;
  contractRent: number;
  paymentCycleMonths: number;
  serviceFee: number;
  maintenancePackageEnabled: boolean;
  maintenanceUnitPricePerKm: number;
  mileage: number;
  customerBearsMaintenance: boolean;
  linkedMaintenanceIds: string[];
  linkedAccidentIds: string[];
  linkedReceiptIds: string[];
  hydrogenBorneBy: '我司承担' | '客户承担' | '';
  isLatestBill: boolean;
  receivableTotal: number;
  receivableRent: number;
  monthlyIncome: number;
  monthlyRent: number;
  maintenanceIncome: number;
  insuranceSurcharge: number;
  opsFeeIncome: number;
  otherIncome: number;
  mileageDeduction: number;
  otherDeduction: number;
  receivedAmount: number;
  invoiceDate: string;
  actualPaymentDate: string;
  paymentMethod: string;
  vehicleStandardCost: number;
  vehicleActualCost: number;
  insuranceFee: number;
  hydrogenFee: number;
  opsFeeCost: number;
  brokerageFee: number;
  otherCost: number;
  totalCost: number;
  profitLoss: number;
  gpsMileage: string;
  otherDeductionDetail: string;
  assetOwnership: AssetOwnership;
  assetOwner?: string;
  signingCompany: string;
  remark: string;
}

export interface LeaseLedgerFilters {
  year: string;
  month: string;
  dept: string;
  salesman: string;
  plateNo: string;
  customerName: string;
  status: string;
  paymentFrom: string;
  paymentTo: string;
}

export const EMPTY_LEASE_FILTERS: LeaseLedgerFilters = {
  year: '',
  month: '',
  dept: '',
  salesman: '',
  plateNo: '',
  customerName: '',
  status: '',
  paymentFrom: '',
  paymentTo: '',
};

export interface LeaseKpiSummary {
  count: number;
  receivableTotal: number;
  receivedAmount: number;
  unreceived: number;
  totalCost: number;
  profitLoss: number;
}

export interface ReceiptRecord {
  id: string;
  arrivalTime: string;
  customerName: string;
  amount: number;
  remark: string;
}

export interface BiMileageRecord {
  plateNo: string;
  year: number;
  month: number;
  mileageKm: number;
}

export interface HydrogenFeeRecord {
  plateNo: string;
  year: number;
  month: number;
  amount: number;
  status: string;
}

export interface MaintenanceOrder {
  id: string;
  plateNo: string;
  orderNo: string;
  type: string;
  bearBy: string;
  amount: number;
  completedAt: string;
}

export interface AccidentRecord {
  id: string;
  plateNo: string;
  accidentNo: string;
  insuranceSurcharge: number;
  occurredAt: string;
  remark: string;
}
