import { ViscaCommand } from 'visca-over-ip';
import { ActionAPI, ActionAPI_StatusTypes } from '../../../ActionAPI';
import { EditorAPI } from '../../../EditorAPI';
import { simpleCommandEditor, simpleCommandHandle } from '../simpleCommandHandler';

module.exports = (actionAPI: ActionAPI) => {
	actionAPI.handle((properties, status: (text: string, type: ActionAPI_StatusTypes) => void) => {
		var command = ViscaCommand.cameraPresetSet(properties.number);
		simpleCommandHandle(actionAPI, command, properties, status);
	});

	actionAPI.onOpenEditor((EditorAPI, properties) => {
		simpleCommandEditor(EditorAPI, properties, [
			{
				id: 'number',
				name: 'Preset Index',
				type: 'number',
				value: properties.number != undefined ? properties.number : 1
			}
		]);
	});
};
