import { NodeConnectionTypes, type INodeDataBaseSchema, type INodeType } from '../../Interface'
import Setter from './setter.vue'
import { getNodeDescription, getNodeDisplayName } from '@/nodes/i18n'

export type MailSenderData = INodeDataBaseSchema & {
	subject: string // '主题'
	body: string // '内容'
	toLists: string // '收件人，多个以,分割'
	ccLists: string // '抄送人，多个以,分割'
	bccLists: string // '密抄人，多个以,分割'
	attachmentLists: string // '附件id, 多个以,分割'
	memo: string // '描述'
	in_queue: boolean // '是否入队'
	delaySeconds: number // '入队列后延时几秒'
}

export const mailSenderNode: INodeType = {
	version: ['1'],
	displayName: getNodeDisplayName('mail-sender'),
	name: 'mail-sender',
	Setter,
	description: getNodeDescription('mail-sender'),
	group: 'tool',
	icon: 'lucide:mail',
	iconColor: '#00c375',
	inputs: [NodeConnectionTypes.main],
	outputs: [NodeConnectionTypes.main],
	// validate: (data: ModuleInvokeData) => {
	// 	return data?.interface_code?.trim()
	// 		? false
	// 		: i18n.t('pages.moduleInvokeSetter.interfaceCodeRequired')
	// },
	// getSubtitle: (data: ModuleInvokeData) => {
	// 	return data?.interface_code ? `code: ${data.interface_code}` : ''
	// },
	schema: {
		appAgentId: '',
		parentId: '',
		position: {
			x: 20,
			y: 30
		},
		width: 96,
		height: 96,
		selected: false,
		nodeType: 'mail-sender',
		zIndex: 1,
		data: {}
	}
}
