<script setup lang="ts">
import { LayoutDashboard } 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_design.label')
    "
    :inputs="[{ id: 'target' }]"
    :outputs="[{ id: 'source' }]"
    :node-id="id"
    node-type="dashboard_design"
  >
    <template #icon><LayoutDashboard class="size-5" /></template>
    <template #desc>
      {{ $t('ai-platform.workflow.nodes.dashboard_design.desc') }}
    </template>
    <div class="space-y-1 text-xs">
      <div v-if="data.design_title" class="text-muted-foreground truncate">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_design.title')
        }}</span>
        {{ data.design_title }}
      </div>
      <div class="text-muted-foreground">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_design.needConfirm')
        }}</span>
        {{
          data.require_confirmation !== false
            ? $t('ai-platform.workflow.nodes.dashboard_design.need')
            : $t('ai-platform.workflow.nodes.dashboard_design.notNeed')
        }}
      </div>
    </div>
    <template #footer>
      <div class="text-muted-foreground truncate text-[10px]">
        {{ $t('ai-platform.workflow.nodes.common.output') }} page_config
      </div>
    </template>
  </BaseNode>
</template>
