import {
	CHAT_TRIGGER_NODE_TYPE,
	FORM_TRIGGER_NODE_TYPE,
	MANUAL_TRIGGER_NODE_TYPE,
	SCHEDULE_TRIGGER_NODE_TYPE,
	WEBHOOK_NODE_TYPE,
} from 'n8n-workflow';

/**
 * TELEMETRY EVENTS - backend
 * Frontend events are defined in @n8n/mcp-apps package
 */
export const USER_CONNECTED_TO_MCP_EVENT = 'User connected to MCP server';
export const USER_CALLED_MCP_TOOL_EVENT = 'User called mcp tool';
export const MCP_PREVIEW_RENDER_REQUESTED_EVENT = 'MCP App preview render requested';

/**
 * Message constants
 */
export const UNAUTHORIZED_ERROR_MESSAGE = 'Unauthorized';
export const INTERNAL_SERVER_ERROR_MESSAGE = 'Internal server error';
export const MCP_ACCESS_DISABLED_ERROR_MESSAGE = 'MCP access is disabled';

/**
 * Triggers supported in production mode for MCP execution
 */
export const SUPPORTED_PRODUCTION_MCP_TRIGGERS = {
	[SCHEDULE_TRIGGER_NODE_TYPE]: 'Schedule Trigger',
	[WEBHOOK_NODE_TYPE]: 'Webhook Trigger',
	[FORM_TRIGGER_NODE_TYPE]: 'Form Trigger',
	[CHAT_TRIGGER_NODE_TYPE]: 'Chat Trigger',
};

/**
 * All triggers supported for MCP (production + manual mode)
 */
export const SUPPORTED_MCP_TRIGGERS = {
	...SUPPORTED_PRODUCTION_MCP_TRIGGERS,
	[MANUAL_TRIGGER_NODE_TYPE]: 'Manual Trigger',
};
