import {ConfigurableNodeDefinition, NodeType, NodeCategory, defineNodeOutputs} from './types';
import { DataSourceType } from "@/domain/dataSource";

/**
 * 通知节点定义
 * 用于发送各种类型的通知（邮件、钉钉、企业微信等）
 */
export const NotificationNodeDefinition: ConfigurableNodeDefinition = {
    nodeCode: "NOTIFICATION",
    nodeName: "通知",
    nodeType: NodeType.NOTIFICATION,
    category: NodeCategory.TASK,
    description: "发送通知消息到指定渠道",

    // 渲染配置
    renderConfig: {
        shape: 'rounded-rect',
        size: {width: 120, height: 60},
        icon: {
            type: 'emoji',
            content: '🔔',
            size: 24
        },
        theme: {
            primary: '#f59e0b',
            secondary: '#d97706',
            selectedBorder: '#3b82f6',
            hoverBorder: '#f59e0b',
            gradient: ['#ffffff', '#fef3c7']
        },
        handles: {
            input: true,
            output: true
        },
        features: {
            showBadge: true,
            showHoverMenu: true
        }
    },

    // 基本配置Schema（仅业务配置，元数据已移至固定表单）
    inputMappingSchema: {
        type: "object",
        title: "输入",
        description: "当前节点所需数据配置",
        properties: {
            // notificationType: {
            //     type: "string",
            //     title: "通知类型",
            //     description: "选择通知发送的渠道",
            //     enum: ["EMAIL", "DINGTALK", "WECHAT_WORK", "SMS"],
            //     enumNames: ["邮件", "钉钉", "企业微信", "短信"],
            //     default: "EMAIL"
            // },
            // notificationChannelType: {
            //     type: "string",
            //     title: "通知类型",
            //     description: "选择通知发送的渠道",
            //     'x-dataSource': DataSourceType.NOTIFICATION_CHANNEL_TYPES
            // },
            notificationChannel: {
                type: "number",
                title: "通知渠道",
                description: "选择通知发送的渠道",
                'x-dataSource': DataSourceType.NOTIFICATION_CHANNELS
            },
            title: {
                type: "string",
                title: "通知标题",
                description: "通知消息的标题",
                default: "工作流通知"
            },
            content: {
                type: "string",
                title: "通知内容",
                description: "通知消息的正文内容，支持变量表达式",
                format: "textarea",
                default: ""
            }
        },
        required: ["notificationChannel", "title", "content"]
    },
    outputs: defineNodeOutputs()
};

