export interface SelfTableColumn {
  key: string;
  title: string;
  money?: boolean;
  className?: string;
  sortable?: boolean;
  sticky?: 'left' | 'right';
  defaultWidth?: number;
}

/** 左侧冻结列（至车牌号码） */
export const SELF_STICKY_LEFT_KEYS = [
  'month',
  'dispatchDate',
  'businessName',
  'driver',
  'phone',
  'plateNo',
] as const;

/** 与 Excel「1.2物流业务台账」表头顺序、文案一致 */
export const SELF_TABLE_COLUMNS: SelfTableColumn[] = [
  { key: 'month', title: '月份', defaultWidth: 72, sticky: 'left' },
  { key: 'dispatchDate', title: '出车日期', defaultWidth: 108, sortable: true, sticky: 'left' },
  { key: 'businessName', title: '业务名称', className: 'ldb-col-name', defaultWidth: 168, sticky: 'left' },
  { key: 'driver', title: '司机', defaultWidth: 80, sticky: 'left' },
  { key: 'phone', title: '电话', defaultWidth: 112, sticky: 'left' },
  { key: 'plateNo', title: '车牌号码', defaultWidth: 104, sticky: 'left', className: 'sob-col-plate' },
  { key: 'systemVehicleType', title: '系统车型', className: 'ldb-col-name', defaultWidth: 168 },
  { key: 'unitPrice', title: '单价', money: true, defaultWidth: 88 },
  { key: 'quantity', title: '数量', money: true, defaultWidth: 64 },
  { key: 'amount', title: '金额', money: true, defaultWidth: 96 },
  { key: 'hydrogenFee', title: '氢费', money: true, defaultWidth: 88 },
  { key: 'etcFee', title: 'ETC费用', money: true, defaultWidth: 88 },
  { key: 'salary', title: '薪资', money: true, defaultWidth: 88 },
  { key: 'electricityFee', title: '电费', money: true, defaultWidth: 80 },
  { key: 'manualReimbursement', title: '人工报销费用', money: true, defaultWidth: 108 },
  { key: 'dailySocialSecurityFee', title: '日社保服务费', money: true, defaultWidth: 108 },
  { key: 'dailyTrailerFee', title: '日挂车费用', money: true, defaultWidth: 96 },
  { key: 'dailyParkingFee', title: '日停车费用', money: true, defaultWidth: 96 },
  { key: 'dailyTireFee', title: '日轮胎费用', money: true, defaultWidth: 96 },
  { key: 'vehicleFee', title: '车辆费用', money: true, defaultWidth: 88 },
  { key: 'totalCost', title: '总成本', money: true, defaultWidth: 96 },
  { key: 'profitLoss', title: '盈亏', money: true, defaultWidth: 96 },
  { key: 'multiTrip', title: '是否多趟', defaultWidth: 80 },
  { key: 'routePricing', title: '线路计价', className: 'ldb-col-name', defaultWidth: 104 },
  { key: 'remark', title: '备注', className: 'ldb-col-name', defaultWidth: 120 },
];

export const DEFAULT_SELF_COLUMN_WIDTHS: Record<string, number> = Object.fromEntries(
  SELF_TABLE_COLUMNS.map((col) => [col.key, col.defaultWidth ?? 100]),
);
