import type { ArchiveStatus, RecordListMode } from './types';

export const ARCHIVE_STATUS_OPTIONS: { id: ArchiveStatus; fullName: string }[] = [
  { id: 'pending', fullName: '待归档' },
  { id: 'ready', fullName: '可归档' },
  { id: 'archived', fullName: '已归档' },
  { id: 'invalid', fullName: '无效' },
];

export const LIST_MODE_LABEL: Record<RecordListMode, string> = {
  main: '培训记录',
  ready: '可归档列表',
  archived: '已归档列表',
};

/** 各列表页路由 */
export const RECORD_LIST_PATH: Record<RecordListMode, string> = {
  main: '/tms/record',
  ready: '/tms/record/ready',
  archived: '/tms/record/archived',
};

export function labelOfArchiveStatus(status?: ArchiveStatus) {
  return ARCHIVE_STATUS_OPTIONS.find((x) => x.id === status)?.fullName || status || '-';
}

export function colorOfArchiveStatus(status?: ArchiveStatus) {
  if (status === 'ready') return '#1677ff';
  if (status === 'archived') return '#52c41a';
  if (status === 'invalid') return '#ff4d4f';
  return undefined;
}
