<template>
  <a-tag :color="tagColor">{{ normalizedStatus }}</a-tag>
</template>

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

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

const normalizedStatus = computed(() => props.status?.trim() || '未标注')

const tagColor = computed(() => {
  switch (normalizedStatus.value) {
    case '有效':
      return 'green'
    case '部分失效':
      return 'orange'
    case '已废止':
      return 'red'
    case '失效':
      return 'default'
    case '待确认':
      return 'gold'
    default:
      return 'blue'
  }
})
</script>