<template>
  <span v-if="icon" class="event-badge" :class="`event-badge--${event.source}`" :title="title">
    <component :is="icon" />
  </span>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { RobotOutlined, ThunderboltOutlined } from '@ant-design/icons-vue'
import type { ICalendarEvent } from '@/api/calendar'

const props = defineProps<{
  event: ICalendarEvent
}>()

const icon = computed(() => {
  switch (props.event.source) {
    case 'agent':
      return RobotOutlined
    case 'post_extract':
      return ThunderboltOutlined
    default:
      return null
  }
})

const title = computed(() => {
  switch (props.event.source) {
    case 'agent':
      return 'Agent 创建'
    case 'post_extract':
      return '对话提取'
    default:
      return ''
  }
})
</script>

<style scoped>
.event-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.event-badge--agent {
  color: var(--accent-team, #722ed1);
}

.event-badge--post_extract {
  color: var(--accent-board, #fa8c16);
}
</style>
