/**
 * 子任务状态映射与颜色配置
 * @author zouzhiwen
 */

export const taskStatusMap: Record<string, string> = {
  CREATED: '已创建',
  READY: '准备就绪',
  IN_PROGRESS: '进行中',
  WAITING_WAKE: '待唤醒',
  WAITING_RELEASE: '待释放',
  COMPLETED: '已完成',
  CANCELED: '已取消',
  FAILED: '失败',
}

export type TaskStatusTagType = 'success' | 'info' | 'warning' | 'danger' | ''

export function getTaskStatusTag(status: string): { type: TaskStatusTagType; effect?: 'dark' | 'plain' } {
  const config: Record<string, { type: TaskStatusTagType; effect?: 'dark' | 'plain' }> = {
    CREATED: { type: 'info' },              // 灰色实心 - 待处理
    READY: { type: '' },
    IN_PROGRESS: { type: '', effect: 'dark' },
    WAITING_WAKE: { type: 'warning' },
    WAITING_RELEASE: { type: 'warning' },
    COMPLETED: { type: 'success' },
    CANCELED: { type: 'info', effect: 'plain' },  // 灰色描边 - 已取消
    FAILED: { type: 'danger' },
  }
  return config[status] || { type: 'info' }
}
