import { IExecuteFunctions } from 'n8n-workflow';
import { logger } from '../../../helpers/logger';
import { getGateways } from './operations/getGateways.methods';
import { getGateway } from './operations/getGateway.methods';
import { deleteGateway } from './operations/deleteGateway.methods';
import { getDetail } from './operations/getDetail.methods';
import { getUplinkBandwidthUsage } from './operations/getUplinkBandwidthUsage.methods';
import { getStats } from './operations/getStats.methods';
import { getWanCompressionStats } from './operations/getWanCompressionStats.methods';
import { getDistribution } from './operations/getDistribution.methods';
import { getPortsBandwidthUsage } from './operations/getPortsBandwidthUsage.methods';
import { getPorts } from './operations/getPorts.methods';
import { getErrors } from './operations/getErrors.methods';
import { getTunnels } from './operations/getTunnels.methods';
import { getClients } from './operations/getClients.methods';
import { getPools } from './operations/getPools.methods';
import { getInfo } from './operations/getInfo.methods';

/**
 * All operations available for the gateway resource
 */
export const gatewayOperations = {
	getGateways,
	getGateway,
	deleteGateway,
	getDetail,
	getUplinkBandwidthUsage,
	getStats,
	getWanCompressionStats,
	getDistribution,
	getPortsBandwidthUsage,
	getPorts,
	getErrors,
	getTunnels,
	getClients,
	getPools,
	getInfo,
};

/**
 * Check if a gateway operation exists
 *
 * @param operation Operation name to check
 * @returns boolean indicating if the operation exists
 */
export function hasGatewayOperation(operation: string): boolean {
	const exists = !!gatewayOperations[operation as keyof typeof gatewayOperations];
	logger.debug(
		'monitoring:gateway:check',
		`Operation "${operation}" ${exists ? 'exists' : 'does not exist'}`,
	);
	return exists;
}
