<template>
  <div class="image-node">
    <StandardNode
      :icon="definition.icon"
      :title="definition.title"
      :subtitle="definition.subtitle"
      :accent="definition.accent"
      :badge="badge"
      :status="status"
      :handles="definition.handles"
      :body-items="bodyItems"
      :selected="props.selected"
    />
  </div>
</template>

<script setup lang="ts">
import { Position } from '@vue-flow/core'
import StandardNode from '../shared/StandardNode.vue'
import { useStandardNode } from '../shared/useStandardNode'
import type { BaseNodeProps } from '../shared/types'
import type { ImageNodeData } from './types'

const props = defineProps<BaseNodeProps<ImageNodeData>>()

const { definition, bodyItems, badge, status } = useStandardNode(props, {
  icon: 'mdi:image-filter-center-focus',
  title: '图像处理',
  subtitle: 'Vision Ops',
  accent: '#d4380d',
  handles: {
    inputs: [Position.Left],
    outputs: [Position.Right]
  },
  badge: ({ data }) => data.operation ?? '增强',
  status: ({ data }) => data.status ?? '等待资源',
  body: ({ data }) => [
    { label: '操作', value: data.operation ?? '未配置' },
    { label: '分辨率', value: data.resolution ?? 'Auto' }
  ]
})
</script>

<style scoped lang="scss">
@use './index.scss' as *;
</style>
