// api/monitoring/monitoring.resources.ts
import { INodeProperties } from 'n8n-workflow';
// Import all operations lists
import { apOperationsList } from './ap/ap.descriptions';
import { clientOperationsList } from './client/client.descriptions';
import { eventsOperationsList } from './events/events.descriptions';
import { gatewayOperationsList } from './gateway/gateway.descriptions';
import { labelOperationsList } from './label/label.descriptions';
import { mobilitycontrollerOperationsList } from './mobilitycontroller/mobilitycontroller.descriptions';
import { networkOperationsList } from './network/network.descriptions';
import { siteOperationsList } from './site/site.descriptions';
import { swarmOperationsList } from './swarm/swarm.descriptions';
import { switchOperationsList } from './switch/switch.descriptions';
import { vpnOperationsList } from './vpn/vpn.descriptions';

// Resource selection for monitoring domain
const resourceSelection: INodeProperties = {
	displayName: 'Resource',
	name: 'resource',
	type: 'options',
	noDataExpression: true,
	displayOptions: {
		show: {
			domain: ['monitoring'],
		},
	},
	options: [
		{
			name: 'Access Point',
			value: 'ap',
			description: 'Work with access point information',
		},
		{
			name: 'Client',
			value: 'client',
			description: 'Work with client information',
		},
		{
			name: 'Events',
			value: 'events',
			description: 'Work with events information',
		},
		{
			name: 'Gateway',
			value: 'gateway',
			description: 'Work with gateway information',
		},
		{
			name: 'Label',
			value: 'label',
			description: 'Work with label information',
		},
		{
			name: 'Mobility Controller',
			value: 'mobilitycontroller',
			description: 'Work with mobility controller information',
		},
		{
			name: 'Network',
			value: 'network',
			description: 'Work with network information',
		},
		{
			name: 'Site',
			value: 'site',
			description: 'Work with site information',
		},
		{
			name: 'Swarm',
			value: 'swarm',
			description: 'Work with swarm information',
		},
		{
			name: 'Switch',
			value: 'switch',
			description: 'Work with switch information',
		},
		{
			name: 'VPN',
			value: 'vpn',
			description: 'Work with VPN information',
		},
	],
	default: 'ap',
};

// Create the resources array with the resource selector and all operation lists
export const monitoringResources: INodeProperties[] = [
	resourceSelection,
	// Include all operations lists with safety checks
	...(Array.isArray(apOperationsList) ? apOperationsList : []),
	...(Array.isArray(clientOperationsList) ? clientOperationsList : []),
	...(Array.isArray(eventsOperationsList) ? eventsOperationsList : []),
	...(Array.isArray(gatewayOperationsList) ? gatewayOperationsList : []),
	...(Array.isArray(labelOperationsList) ? labelOperationsList : []),
	...(Array.isArray(mobilitycontrollerOperationsList) ? mobilitycontrollerOperationsList : []),
	...(Array.isArray(networkOperationsList) ? networkOperationsList : []),
	...(Array.isArray(siteOperationsList) ? siteOperationsList : []),
	...(Array.isArray(swarmOperationsList) ? swarmOperationsList : []),
	...(Array.isArray(switchOperationsList) ? switchOperationsList : []),
	...(Array.isArray(vpnOperationsList) ? vpnOperationsList : []),
];

// Export the resource selection for use in other files
export const monitoringResourceSelection = resourceSelection;
