import { connectivityOperations } from './connectivity/connectivity.methods';
import { insightsOperations } from './insights/insights.methods';
import { insightDetailsOperations } from './insightDetails/insightDetails.methods';
import { logger } from '../../helpers/logger';

/**
 * Operations available in the aiops domain
 */
export const aiopsOperations = {
	connectivity: connectivityOperations,
	insights: insightsOperations,
	insightDetails: insightDetailsOperations,
};

/**
 * Check if an operation exists in the aiops domain
 * @param resource Resource name
 * @param operation Operation name
 * @returns boolean indicating if the operation exists
 */
export function hasOperation(resource: string, operation: string): boolean {
	if (!aiopsOperations[resource]) {
		logger.debug('aiops:check', `Resource "${resource}" not found`);
		return false;
	}

	if (!aiopsOperations[resource][operation]) {
		logger.debug('aiops:check', `Operation "${operation}" not found in resource "${resource}"`);
		return false;
	}

	return true;
}
