import { INodeProperties } from 'n8n-workflow';
import { addDescriptions } from '../../../helpers/deduplicate';
import { getLabelsDescription } from './operations/getLabels.descriptions';
import { postLabelDescription } from './operations/postLabel.descriptions';
import { getLabelDescription } from './operations/getLabel.descriptions';
import { patchLabelDescription } from './operations/patchLabel.descriptions';
import { deleteLabelDescription } from './operations/deleteLabel.descriptions';
import { postDevicesDescription } from './operations/postDevices.descriptions';
import { deleteDevicesDescription } from './operations/deleteDevices.descriptions';
import { getCategoriesDescription } from './operations/getCategories.descriptions';

/**
 * Operation selector for the label resource
 */
export const labelOperationSelector: INodeProperties = {
	displayName: 'Operation',
	name: 'operation',
	type: 'options',
	noDataExpression: true,
	displayOptions: {
		show: {
			resource: ['label'],
			domain: ['monitoring'],
		},
	},
	options: [
		{
			name: 'Get Labels',
			value: 'getLabels',
			description: 'List Labels',
			action: 'Get Labels',
		},
		{
			name: 'Post Label',
			value: 'postLabel',
			description: 'Create Label',
			action: 'Create post label',
		},
		{
			name: 'Get Labels',
			value: 'getLabels',
			description: 'List Default Labels',
			action: 'Get Labels',
		},
		{
			name: 'Get Label',
			value: 'getLabel',
			description: 'Label details',
			action: 'Get Label',
		},
		{
			name: 'Patch Label',
			value: 'patchLabel',
			description: 'Update Label',
			action: 'Update patch label',
		},
		{
			name: 'Delete Label',
			value: 'deleteLabel',
			description: 'Delete Label',
			action: 'Delete Label',
		},
		{
			name: 'Post Label',
			value: 'postLabel',
			description: 'Associate Label to device',
			action: 'Create post label',
		},
		{
			name: 'Delete Label',
			value: 'deleteLabel',
			description: 'Unassociate Label from device',
			action: 'Delete Label',
		},
		{
			name: 'Post Devices',
			value: 'postDevices',
			description: 'Associate Label to a list of devices',
			action: 'Create post devices',
		},
		{
			name: 'Delete Devices',
			value: 'deleteDevices',
			description: 'Unassociate a label from a list of devices',
			action: 'Delete Devices',
		},
		{
			name: 'Get Categories',
			value: 'getCategories',
			description: 'List Label Categories',
			action: 'Get Categories',
		},
	],
	default: 'getLabels',
};

// Combined descriptions for all operations in this resource
export const labelDescriptions: INodeProperties[] = [labelOperationSelector];

// Add each operation's descriptions
addDescriptions(labelDescriptions, getLabelsDescription);
addDescriptions(labelDescriptions, postLabelDescription);
addDescriptions(labelDescriptions, getLabelDescription);
addDescriptions(labelDescriptions, patchLabelDescription);
addDescriptions(labelDescriptions, deleteLabelDescription);
addDescriptions(labelDescriptions, postDevicesDescription);
addDescriptions(labelDescriptions, deleteDevicesDescription);
addDescriptions(labelDescriptions, getCategoriesDescription);
