import {
	NodeConnectionTypes,
	type INodeType,
	type INodeDataBaseSchema,
	type NodeVariable
} from '../../Interface'

import Setter from './setter.vue'
import { getNodeDescription, getNodeDisplayName } from '@/nodes/i18n'

export type IterationData = INodeDataBaseSchema & {
	error_handle_mode: 'terminated' | 'continue-on-error' | 'remove-abnormal-output'
	is_parallel: boolean
	parallel_nums: number
	flatten_output: boolean
	start_node_id: string
	output_iteration_variable: NodeVariable
}

export const iterationNode: INodeType = {
	version: ['1'],
	displayName: getNodeDisplayName('iteration'),
	name: 'iteration',
	Setter,
	description: getNodeDescription('iteration'),
	group: 'logic',
	icon: 'lucide:repeat-2',
	iconColor: '#06aed4',
	inputs: [NodeConnectionTypes.main],
	outputs: [NodeConnectionTypes.main],
	schema: {
		appAgentId: '',
		parentId: '',
		position: {
			x: 20,
			y: 30
		},
		width: 424,
		height: 244,
		selected: false,
		nodeType: 'iteration',
		zIndex: 1,
		data: {}
	}
}
