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

import BaseNode from './BaseNode.vue';

defineProps(['selected', 'data', 'id']);
</script>

<template>
  <BaseNode
    :selected="selected"
    :execution-status="data.executionStatus"
    :execution-result="data.executionResult"
    :label="data.label || $t('ai-platform.workflow.nodes.form_publish.label')"
    :inputs="[{ id: 'target' }]"
    :outputs="[{ id: 'source' }]"
    :node-id="id"
    node-type="form_publish"
  >
    <template #icon><Send class="size-5" /></template>
    <template #desc>
      {{ $t('ai-platform.workflow.nodes.form_publish.desc') }}
    </template>

    <div class="space-y-2">
      <div class="text-muted-foreground space-y-1 text-xs">
        <div class="flex justify-between">
          <span>{{
            $t('ai-platform.workflow.nodes.form_publish.menuName')
          }}</span>
          <span class="max-w-[120px] truncate">{{
            data.menu_name ||
            $t('ai-platform.workflow.nodes.form_publish.notSet')
          }}</span>
        </div>
        <div class="flex justify-between">
          <span>{{
            $t('ai-platform.workflow.nodes.form_publish.menuIcon')
          }}</span>
          <span>{{ data.menu_icon || 'lucide:file-text' }}</span>
        </div>
      </div>

      <!-- 输出变量 -->
      <div class="rounded bg-green-50 px-2 py-1 text-xs dark:bg-green-950">
        <div
          class="flex items-center justify-between text-green-700 dark:text-green-300"
        >
          <span>{{ $t('ai-platform.workflow.nodes.common.output') }}</span>
          <span class="font-mono">menu_id, route_path</span>
        </div>
      </div>
    </div>
  </BaseNode>
</template>
