import type { ResourceInfo } from '@n8n/ai-utilities/node-catalog';

export interface DiscoveryContext {
	nodesFound: Array<{
		nodeName: string;
		version: number;
		reasoning: string;
		/**
		 * Parameters that affect node connections (inputs/outputs).
		 * Discovered by analyzing <input>/<output> tags in node details.
		 * Examples: mode, hasOutputParser, textSplittingMode
		 *
		 * Note: For nodes with resource/operation pattern, these may overlap
		 * with availableResources - connectionChangingParameters tells WHICH
		 * parameters matter, availableResources tells WHAT values are available.
		 */
		connectionChangingParameters: Array<{
			name: string;
			possibleValues: Array<string | boolean | number>;
		}>;
		/**
		 * Available resources and operations for nodes following the
		 * resource/operation pattern (Gmail, Notion, Google Sheets, etc.).
		 *
		 * Used by Builder to set initialParameters: { resource, operation }
		 * which then enables it to filter properties correctly when configuring.
		 *
		 * Only present for nodes that follow the resource/operation pattern.
		 */
		availableResources?: ResourceInfo[];
	}>;
	bestPractices?: string;
	/** Content fetched via web_fetch during discovery */
	fetchedUrlContent?: Array<{
		url: string;
		status: 'success' | 'error';
		title: string;
		content: string;
	}>;
}
