import * as i0 from '@angular/core';
import { Injector } from '@angular/core';
import { ExtensionPointForPlugins, PluginsResolveService } from '@c8y/ngx-components';
import { Observable } from 'rxjs';

/**
 * Represents a predefined operation template that can be registered
 * and selected in the operation render type modal.
 */
interface OperationTemplate {
    /** Display name shown in the dropdown. */
    name: string;
    /** The operation command object that will be serialized as JSON into the command field.
     * The command object must contain a `description` property, which will be used as the description of the operation in the UI.
     * The rest of the properties can be defined based on the requirements of the specific operation.
     * For example, a restart operation might look like this:
     * ```
     * {
     *   description: 'Restart device',
     *   c8y_Restart: {}
     * }
     * ```
     * Or a more complex command with parameters:
     * ```
     * {
     *   description: 'Set relay status to OPEN',
     *   c8y_Relay: {
     *     relayState: 'OPEN'
     *   }
     * }
     * ```
     */
    command: Record<string, unknown>;
}

declare class OperationTemplateService extends ExtensionPointForPlugins<OperationTemplate> {
    items$: Observable<OperationTemplate[]>;
    constructor(rootInjector: Injector, pluginService: PluginsResolveService);
    get state(): Set<OperationTemplate>;
    protected setupItemsObservable(): Observable<OperationTemplate[]>;
    static ɵfac: i0.ɵɵFactoryDeclaration<OperationTemplateService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<OperationTemplateService>;
}

interface OperationModalResult {
    buttonLabel: string;
    operation: string | null;
    command: string;
}
interface OperationModalInitialConfig {
    buttonLabel?: string;
    operationType?: string;
    command?: string;
}

declare class OperationPickerService {
    private readonly modalService;
    /**
     *
     * @param options Modal configuration options
     * `showButtonLabelOnly` - if `true`, only button label will be shown in the modal, otherwise user will be able to select both operation and command. This is useful when you want to allow users to select only predefined operations (e.g. restart, shutdown) without showing them the underlying operation types and commands.
     * `deviceTypes` - list of device types to filter available operations. Only operations applicable to the provided device types will be shown in the modal.
     * `initialConfig` - initial configuration for the modal form. This is useful when you want to edit existing configuration, so you can prefill the form with existing values.
     * @returns
     */
    openModal(options: {
        showButtonLabelOnly: boolean;
        deviceTypes: string[];
        initialConfig?: Partial<OperationModalInitialConfig>;
    }): Promise<OperationModalResult>;
    static ɵfac: i0.ɵɵFactoryDeclaration<OperationPickerService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<OperationPickerService>;
}

export { OperationPickerService, OperationTemplateService };
export type { OperationModalInitialConfig, OperationModalResult };
//# sourceMappingURL=index.d.ts.map
