// api/monitoring/client/operations/getClients.descriptions.ts
import { INodeProperties } from 'n8n-workflow';

/**
 * UI parameters for the getWirelessClients operation
 */
export const getWirelessClientsDescription: INodeProperties[] = [
	{
		displayName: 'Additional Fields',
		name: 'additionalFields',
		type: 'collection',
		placeholder: 'Add Field',
		default: {},
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getWirelessClients'],
			},
		},
		options: [
			{
				displayName: 'Group',
				name: 'group',
				type: 'string',
				default: '',
				description: 'Filter by group name',
			},
			{
				displayName: 'Swarm ID',
				name: 'swarm_id',
				type: 'string',
				default: '',
				description: 'Filter by Swarm ID',
			},
			{
				displayName: 'Label',
				name: 'label',
				type: 'string',
				default: '',
				description: 'Filter by Label name',
			},
			{
				displayName: 'Site',
				name: 'site',
				type: 'string',
				default: '',
				description: 'Filter by Site name',
			},
			{
				displayName: 'Network',
				name: 'network',
				type: 'string',
				default: '',
				description: 'Filter by network name',
			},
			{
				displayName: 'Serial',
				name: 'serial',
				type: 'string',
				default: '',
				description: 'Filter by AP serial number',
			},
			{
				displayName: 'OS Type',
				name: 'os_type',
				type: 'string',
				default: '',
				description: 'Filter by client OS type',
			},
			{
				displayName: 'Cluster ID',
				name: 'cluster_id',
				type: 'string',
				default: '',
				description: 'Filter by Mobility Controller serial number',
			},
			{
				displayName: 'Band',
				name: 'band',
				type: 'options',
				options: [
					{
						name: '2.4 GHz',
						value: '2.4',
					},
					{
						name: '5 GHz',
						value: '5',
					},
					{
						name: '6 GHz',
						value: '6',
					},
				],
				default: '',
				description: 'Filter by radio band',
			},
			{
				displayName: 'Fields',
				name: 'fields',
				type: 'string',
				default: '',
				description:
					'Comma separated list of fields to be returned. Valid fields are name, ip_address, username, os_type, connection, associated_device, group_name, swarm_id, network, radio_mac, manufacturer, vlan, encryption_method, radio_number, speed, usage, health, labels, site, signal_strength, signal_db, snr',
			},
			{
				displayName: 'Calculate Total',
				name: 'calculate_total',
				type: 'boolean',
				default: false,
				description: 'Whether to calculate total clients',
			},
			{
				displayName: 'Offset',
				name: 'offset',
				type: 'number',
				default: 0,
				description: 'Pagination offset',
			},
			{
				displayName: 'Limit',
				name: 'limit',
				type: 'number',
				default: 100,
				description: 'Pagination limit. Default is 100 and max is 1000',
			},
			{
				displayName: 'Sort',
				name: 'sort',
				type: 'options',
				options: [
					{
						name: 'MAC Address (Ascending)',
						value: '+macaddr',
					},
					{
						name: 'MAC Address (Descending)',
						value: '-macaddr',
					},
				],
				default: '+macaddr',
				description: 'Sort parameter may be one of +macaddr, -macaddr',
			},
			{
				displayName: 'Last Client MAC',
				name: 'last_client_mac',
				type: 'string',
				default: '',
				description:
					'Input the last processed client mac that got received in your last response. When this is provided, offset will not be used and results are sorted by macaddr.',
			},
		],
	},
];

/**
 * UI parameters for the getWiredClients operation
 */
export const getWiredClientsDescription: INodeProperties[] = [
	{
		displayName: 'Additional Fields',
		name: 'additionalFields',
		type: 'collection',
		placeholder: 'Add Field',
		default: {},
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getWiredClients'],
			},
		},
		options: [
			{
				displayName: 'Group',
				name: 'group',
				type: 'string',
				default: '',
				description: 'Filter by group name',
			},
			{
				displayName: 'Swarm ID',
				name: 'swarm_id',
				type: 'string',
				default: '',
				description: 'Filter by Swarm ID',
			},
			{
				displayName: 'Label',
				name: 'label',
				type: 'string',
				default: '',
				description: 'Filter by Label name',
			},
			{
				displayName: 'Site',
				name: 'site',
				type: 'string',
				default: '',
				description: 'Filter by Site name',
			},
			{
				displayName: 'Serial',
				name: 'serial',
				type: 'string',
				default: '',
				description: 'Filter by Switch or AP serial number',
			},
			{
				displayName: 'Cluster ID',
				name: 'cluster_id',
				type: 'string',
				default: '',
				description: 'Filter by Mobility Controller serial number',
			},
			{
				displayName: 'Stack ID',
				name: 'stack_id',
				type: 'string',
				default: '',
				description: 'Filter by Switch stack_id',
			},
			{
				displayName: 'Fields',
				name: 'fields',
				type: 'string',
				default: '',
				description:
					'Comma separated list of fields to be returned. Valid fields are name, ip_address, username, associated_device, group_name, interface_mac, vlan',
			},
			{
				displayName: 'Calculate Total',
				name: 'calculate_total',
				type: 'boolean',
				default: false,
				description: 'Whether to calculate total clients',
			},
			{
				displayName: 'Offset',
				name: 'offset',
				type: 'number',
				default: 0,
				description: 'Pagination offset',
			},
			{
				displayName: 'Limit',
				name: 'limit',
				type: 'number',
				default: 100,
				description: 'Pagination limit. Default is 100 and max is 1000',
			},
			{
				displayName: 'Sort',
				name: 'sort',
				type: 'options',
				options: [
					{
						name: 'MAC Address (Ascending)',
						value: '+macaddr',
					},
					{
						name: 'MAC Address (Descending)',
						value: '-macaddr',
					},
				],
				default: '+macaddr',
				description: 'Sort parameter may be one of +macaddr, -macaddr',
			},
			{
				displayName: 'Last Client MAC',
				name: 'last_client_mac',
				type: 'string',
				default: '',
				description:
					'Input the last processed client mac that got received in your last response. When this is provided, offset will not be used and results are sorted by macaddr.',
			},
		],
	},
];

/**
 * UI parameters for the getUnifiedClients operation
 */
export const getUnifiedClientsDescription: INodeProperties[] = [
	{
		displayName: 'Client Type',
		name: 'client_type',
		type: 'options',
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getUnifiedClients'],
			},
		},
		options: [
			{
				name: 'Wireless',
				value: 'WIRELESS',
				description: 'List wireless clients',
			},
			{
				name: 'Wired',
				value: 'WIRED',
				description: 'List wired clients',
			},
		],
		default: 'WIRELESS',
		description: 'Type of client to get',
		required: true,
	},
	{
		displayName: 'Client Status',
		name: 'client_status',
		type: 'options',
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getUnifiedClients'],
			},
		},
		options: [
			{
				name: 'Connected',
				value: 'CONNECTED',
				description: 'List connected clients',
			},
			{
				name: 'Failed to Connect',
				value: 'FAILED_TO_CONNECT',
				description: 'List failed clients (wireless only)',
			},
		],
		default: 'CONNECTED',
		description:
			'Status of clients to retrieve. Failed to connect status not supported for wired clients',
		required: true,
	},
	{
		displayName: 'Timerange',
		name: 'timerange',
		type: 'options',
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getUnifiedClients'],
			},
		},
		options: [
			{
				name: '3 Hours',
				value: '3H',
				description: '3 hours of client information',
			},
			{
				name: '1 Day',
				value: '1D',
				description: '1 day of client information',
			},
			{
				name: '1 Week',
				value: '1W',
				description: '1 week of client information',
			},
			{
				name: '1 Month',
				value: '1M',
				description: '1 month of client information',
			},
			{
				name: '3 Months',
				value: '3M',
				description: '3 months of client information',
			},
		],
		default: '3H',
		description: 'Time range for unified client information',
		required: true,
	},
	{
		displayName: 'Additional Fields',
		name: 'additionalFields',
		type: 'collection',
		placeholder: 'Add Field',
		default: {},
		displayOptions: {
			show: {
				resource: ['client'],
				domain: ['monitoring'],
				operation: ['getUnifiedClients'],
			},
		},
		options: [
			{
				displayName: 'Group',
				name: 'group',
				type: 'string',
				default: '',
				description:
					'Filter by group name. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Swarm ID',
				name: 'swarm_id',
				type: 'string',
				default: '',
				description:
					'Filter by Swarm ID. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Label',
				name: 'label',
				type: 'string',
				default: '',
				description:
					'Filter by Label name. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Site',
				name: 'site',
				type: 'string',
				default: '',
				description:
					'Filter by Site name. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Network',
				name: 'network',
				type: 'string',
				default: '',
				description:
					'Filter by network name. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Cluster ID',
				name: 'cluster_id',
				type: 'string',
				default: '',
				description:
					'Filter by Mobility Controller serial number. You can only specify one of group, swarm_id, cluster_id, network, site and label parameters',
			},
			{
				displayName: 'Serial',
				name: 'serial',
				type: 'string',
				default: '',
				description: 'Filter by device serial number',
			},
			{
				displayName: 'Band',
				name: 'band',
				type: 'options',
				options: [
					{
						name: '2.4 GHz',
						value: '2.4',
					},
					{
						name: '5 GHz',
						value: '5',
					},
					{
						name: '6 GHz',
						value: '6',
					},
				],
				default: '',
				description: 'Filter by radio band. Field supported for wireless clients only',
			},
			{
				displayName: 'Stack ID',
				name: 'stack_id',
				type: 'string',
				default: '',
				description: 'Filter by Switch stack_id. Only for wired clients',
			},
			{
				displayName: 'OS Type',
				name: 'os_type',
				type: 'string',
				default: '',
				description: 'Filter by OS Type',
			},
			{
				displayName: 'Fields',
				name: 'fields',
				type: 'string',
				default: '',
				description:
					'Comma separated list of fields to be returned. Valid fields for wired clients are name, ip_address, username, associated_device, group_name, interface_mac, vlan. Valid field values for wireless clients are name, ip_address, username, os_type, connection, associated_device, group_name, swarm_id, network, radio_mac, manufacturer, vlan, encryption_method, radio_number, speed, usage, health, labels, site, signal_strength, signal_db, snr',
			},
			{
				displayName: 'Calculate Total',
				name: 'calculate_total',
				type: 'boolean',
				default: false,
				description: 'Whether to calculate total Wireless/Wired clients',
			},
			{
				displayName: 'Offset',
				name: 'offset',
				type: 'number',
				default: 0,
				description: 'Pagination offset',
			},
			{
				displayName: 'Limit',
				name: 'limit',
				type: 'number',
				default: 100,
				description: 'Pagination limit. Default is 100 and max is 1000',
			},
			{
				displayName: 'Sort',
				name: 'sort',
				type: 'options',
				options: [
					{
						name: 'MAC Address (Ascending)',
						value: '+macaddr',
					},
					{
						name: 'MAC Address (Descending)',
						value: '-macaddr',
					},
				],
				default: '+macaddr',
				description: 'Sort parameter may be one of +macaddr, -macaddr',
			},
			{
				displayName: 'Last Client MAC',
				name: 'last_client_mac',
				type: 'string',
				default: '',
				description:
					'Input the last processed client mac that got received in your last response. When this is provided, offset will not be used and results are sorted by macaddr',
			},
			{
				displayName: 'Show Usage',
				name: 'show_usage',
				type: 'boolean',
				default: false,
				description:
					'Whether to show usage. Total of received and transmitted data for the specified timerange',
			},
			{
				displayName: 'Show Manufacturer',
				name: 'show_manufacturer',
				type: 'boolean',
				default: false,
				description: 'Whether to show device manufacturer information',
			},
			{
				displayName: 'Show Signal DB',
				name: 'show_signal_db',
				type: 'boolean',
				default: false,
				description:
					'Whether to show signal_db and signal_strength. Field supported for wireless clients only',
			},
		],
	},
];

// Combine all client descriptions
export const getClientsDescription: INodeProperties[] = [
	...getWirelessClientsDescription,
	...getWiredClientsDescription,
	...getUnifiedClientsDescription,
];
