<script setup lang="ts">
import { computed } from 'vue';
import { NTag } from 'naive-ui';

type Confidence = 'high' | 'medium' | 'low';

const props = defineProps<{
  confidence: Confidence;
  showLabel?: boolean;
}>();

const tagType = computed<'success' | 'warning' | 'error'>(() => {
  if (props.confidence === 'high') return 'success';
  if (props.confidence === 'medium') return 'warning';
  return 'error';
});

const label = computed(() => {
  if (props.confidence === 'high') return 'High';
  if (props.confidence === 'medium') return 'Medium';
  return 'Low';
});
</script>

<template>
  <NTag :type="tagType" size="small" round>
    <span v-if="showLabel !== false">置信度</span> {{ label }}
  </NTag>
</template>
