import { INodeProperties } from 'n8n-workflow';

/**
 * Parameters for getErrors operation
 */
export const getErrorsDescription: INodeProperties[] = [
	{
		displayName: 'Return All',
		name: 'returnAll',
		type: 'boolean',
		default: false,
		description: 'Whether to return all results or only up to a given limit',
		displayOptions: {
			show: {
				operation: ['getErrors'],
				resource: ['gateway'],
				domain: ['monitoring'],
			},
		},
	},
	{
		displayName: 'Limit',
		name: 'limit',
		type: 'number',
		default: 50,
		description: 'Max number of results to return',
		typeOptions: {
			minValue: 1,
		},
		displayOptions: {
			show: {
				operation: ['getErrors'],
				resource: ['gateway'],
				domain: ['monitoring'],
				returnAll: [false],
			},
		},
	},

	{
		displayName: 'Serial',
		name: 'serial',
		type: 'string',
		required: true,
		default: '',
		displayOptions: {
			show: {
				resource: ['gateway'],
				domain: ['monitoring'],
				operation: ['getErrors'],
			},
		},
		description: 'Serial number of Gateway to be queried',
	},
	{
		displayName: 'Port',
		name: 'port',
		type: 'string',
		required: true,
		default: '',
		displayOptions: {
			show: {
				resource: ['gateway'],
				domain: ['monitoring'],
				operation: ['getErrors'],
			},
		},
		description: 'Filter by Port (example GE0/0/1)',
	},

	{
		displayName: 'Additional Fields',
		name: 'additionalFields',
		type: 'collection',
		placeholder: 'Add Field',
		default: {},
		displayOptions: {
			show: {
				resource: ['gateway'],
				domain: ['monitoring'],
				operation: ['getErrors'],
			},
		},
		options: [
			{
				displayName: 'Interval',
				name: 'interval',
				type: 'string',
				default: '',
				description: 'Sampling interval of Port Errors.',
				options: [
					{
						name: '5minutes',
						value: '5minutes',
					},
					{
						name: '1hour',
						value: '1hour',
					},
					{
						name: '1day',
						value: '1day',
					},
					{
						name: '1week',
						value: '1week',
					},
				],
			},
		],
	},
];
