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

export const chainStatusMap: Record<string, string> = {
  CREATED: '已创建',
  WAITING: '等待资源',
  READY: '可执行',
  IN_PROGRESS: '进行中',
  COMPLETED: '已完成',
  CANCELED: '已取消',
  FAILED: '失败',
}

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

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