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

    <div class="space-y-2">
      <div
        class="flex items-center justify-between rounded bg-indigo-50 px-2 py-1 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300"
      >
        <span class="font-medium">Analyst</span>
        <span>{{
          $t('ai-platform.workflow.nodes.snowflake_cortex_analyst.nlQuery')
        }}</span>
      </div>

      <div class="text-muted-foreground space-y-1 text-xs">
        <div class="flex justify-between">
          <span>{{
            $t(
              'ai-platform.workflow.nodes.snowflake_cortex_analyst.questionLabel',
            )
          }}</span>
          <span>{{
            data.question
              ? $t('ai-platform.workflow.nodes.common.configured')
              : '-'
          }}</span>
        </div>
        <div class="flex justify-between">
          <span>{{
            $t(
              'ai-platform.workflow.nodes.snowflake_cortex_analyst.semanticModel',
            )
          }}</span>
          <span>{{
            data.semantic_model_file
              ? $t('ai-platform.workflow.nodes.common.configured')
              : '-'
          }}</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.outputVariable')
          }}</span>
          <span class="font-mono">{{
            data.output_variable || 'analyst_result'
          }}</span>
        </div>
      </div>
    </div>
  </BaseNode>
</template>
