<script setup lang="ts">
import { FilePlus } 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_create.label')
    "
    :inputs="[{ id: 'target' }]"
    :outputs="[{ id: 'source' }]"
    :node-id="id"
    node-type="dashboard_create"
  >
    <template #icon><FilePlus class="size-5" /></template>
    <template #desc>
      {{ $t('ai-platform.workflow.nodes.dashboard_create.desc') }}
    </template>
    <div class="space-y-1 text-xs">
      <div
        v-if="data.dashboard_basic_info"
        class="text-muted-foreground truncate"
      >
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_create.basicInfo')
        }}</span>
        {{ $t('ai-platform.workflow.nodes.common.configured') }}
      </div>
      <div v-if="data.page_config" class="text-muted-foreground truncate">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_create.pageConfig')
        }}</span>
        {{ $t('ai-platform.workflow.nodes.common.configured') }}
      </div>
      <div class="text-muted-foreground">
        <span class="font-medium">{{
          $t('ai-platform.workflow.nodes.dashboard_create.updateIfExists')
        }}</span>
        {{
          data.update_if_exists !== false
            ? $t('ai-platform.workflow.nodes.common.yes')
            : $t('ai-platform.workflow.nodes.common.no')
        }}
      </div>
    </div>
    <template #footer>
      <div class="text-muted-foreground truncate text-[10px]">
        {{ $t('ai-platform.workflow.nodes.common.output') }} dashboard_id,
        dashboard_code
      </div>
    </template>
  </BaseNode>
</template>
