import { apOperations } from './ap/ap.methods';
import { clientOperations } from './client/client.methods';
import { siteOperations } from './site/site.methods';
import { eventsOperations } from './events/events.methods';
import { switchOperations } from './switch/switch.methods';
import { gatewayOperations } from './gateway/gateway.methods';
import { labelOperations } from './label/label.methods';
import { mobilitycontrollerOperations } from './mobilitycontroller/mobilitycontroller.methods';
import { networkOperations } from './network/network.methods';
import { swarmOperations } from './swarm/swarm.methods';
import { vpnOperations } from './vpn/vpn.methods';
import { logger } from '../../helpers/logger';

/**
 * Operations available in the monitoring domain
 */
export const monitoringOperations = {
	ap: apOperations,
	client: clientOperations,
	events: eventsOperations,
	gateway: gatewayOperations,
	label: labelOperations,
	mobilitycontroller: mobilitycontrollerOperations,
	network: networkOperations,
	site: siteOperations,
	swarm: swarmOperations,
	switch: switchOperations,
	vpn: vpnOperations,
};

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

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

	return true;
}
