<script setup lang="ts">
import { Square } 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="$t('ai-platform.workflow.nodes.end.label')"
    :inputs="[{ id: 'target' }]"
    :node-id="id"
    node-type="end"
  >
    <template #icon><Square class="size-5" /></template>
    <template #desc>{{ $t('ai-platform.workflow.nodes.end.desc') }}</template>

    <div class="bg-muted text-muted-foreground rounded p-2 text-xs">
      <div v-if="data.outputs && data.outputs.length > 0">
        {{
          $t('ai-platform.workflow.nodes.common.outputVariablesCount', {
            count: data.outputs.length,
          })
        }}
      </div>
      <div v-else>
        {{ $t('ai-platform.workflow.nodes.common.noOutputVariables') }}
      </div>
    </div>
  </BaseNode>
</template>
