<script setup lang="ts">
import { computed } from 'vue'

const props = defineProps<{
  status?: string
}>()

/** 将任务/模型状态映射为 Element Plus tag 类型 */
const tagInfo = computed(() => {
  const s = props.status || ''
  switch (s) {
    case 'running':
    case 'ready':
    case 'loaded':
      return { text: s === 'ready' || s === 'loaded' ? '已就绪' : '运行中', type: 'success' as const }
    case 'pending':
      return { text: '等待中', type: 'info' as const }
    case 'failed':
      return { text: '失败', type: 'danger' as const }
    case 'starting':
    case 'loading':
      return { text: '加载中', type: 'warning' as const }
    case 'completed':
      return { text: '已完成', type: 'success' as const }
    case 'stopped':
      return { text: '已停止', type: 'info' as const }
    default:
      return { text: s || '未知', type: 'info' as const }
  }
})
</script>

<template>
  <el-tag :type="tagInfo.type" size="small" effect="light">{{ tagInfo.text }}</el-tag>
</template>
