<script setup lang="ts">
import { Upload } from '@vben/icons';
import { $t } from '@vben/locales';

import BaseNode from './BaseNode.vue';

defineProps<{
  data: any;
  id: string;
  selected: boolean;
}>();
</script>

<template>
  <BaseNode
    :selected="selected"
    :execution-status="data.executionStatus"
    :execution-result="data.executionResult"
    :label="
      data.label || $t('ai-platform.workflow.nodes.dashboard_publish.label')
    "
    :inputs="[{ id: 'target' }]"
    :outputs="[{ id: 'source' }]"
    :node-id="id"
    node-type="dashboard_publish"
  >
    <template #icon><Upload class="size-5" /></template>
    <template #desc>
      {{ $t('ai-platform.workflow.nodes.dashboard_publish.desc') }}
    </template>
    <div class="space-y-1 text-xs">
      <div v-if="data.dashboard_id" class="text-muted-foreground truncate">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_publish.dashboard')
        }}</span>
        {{ data.dashboard_id }}
      </div>
      <div v-if="data.menu_name" class="text-muted-foreground truncate">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_publish.menuName')
        }}</span>
        {{ data.menu_name }}
      </div>
      <div v-if="data.menu_icon" class="text-muted-foreground truncate">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_publish.icon')
        }}</span>
        {{ data.menu_icon }}
      </div>
    </div>
    <template #footer>
      <div class="text-muted-foreground truncate text-[10px]">
        {{ $t('ai-platform.workflow.nodes.common.output') }} menu_id, route_path
      </div>
    </template>
  </BaseNode>
</template>
