import { IManagedObject, IExternalIdentity, IResultList, InventoryService, IdentityService, AuditService, EventService, UserService } from '@c8y/client';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
import { Observable } from 'rxjs';
import { AppStateService, AlertService, GridConfigContextProvider, C8yStepper, Column, ModalService, BottomDrawerRef, UserPreferencesGridConfigContext } from '@c8y/ngx-components';
import { DeviceGridService } from '@c8y/ngx-components/device-grid';
import * as i0 from '@angular/core';

interface ReplaceDeviceContext {
    deviceToReplace: IManagedObject;
    replacementDevice: IManagedObject;
    replacementDeviceId: string;
    newExternalIds: IExternalIdentity[];
    oldExternalIds: IExternalIdentity[];
    deleteReplacedDeviceOwner: boolean;
    time: string;
    skip?: boolean;
}
interface Error {
    text: string;
    detailedData?: string | {
        status: string;
        statusText: string;
    };
}
/**
 * Declares an execution step in the device replacement flow.
 */
interface ReplaceDeviceStep {
    /**
     * Label to be used in the replace device wizard UI.
     */
    label: string;
    /**
     * Step implementation.
     */
    action: (context: ReplaceDeviceContext) => Observable<unknown> | Promise<unknown>;
    /**
     * Defines if the result from step execution should be passed to the next step in the flow.
     */
    overrideContext?: boolean;
    info?: StepInfo;
    /**
     * Current execution state of the step.
     */
    state?: ReplaceDeviceStepState;
    /**
     * Error occured during step execution.
     */
    error?: Error;
    /**
     * !Internal use only! Flag to skip step execution, used to control retrial.
     */
    skip?: boolean;
    /**
     * !Internal use only! Stores the context the step was initially executed with.
     */
    context?: ReplaceDeviceContext;
    /**
     * !Internal use only! Context to be used for step re-trial.
     */
    seed?: ReplaceDeviceContext;
}
/**
 * Allows to display an info popover for a particular step.
 */
interface StepInfo {
    /**
     * Message that will be displayed as a popover for the given step.
     */
    msg?: string | undefined;
    /**
     * A function that will be executed
     */
    getMessage?: (context: ReplaceDeviceContext, step: ReplaceDeviceStep) => string | undefined;
}
declare const REPLACE_DEVICE_STEP_STATES: readonly ["Pending", "Executing", "Skipped", "Failed", "Successful"];
type ReplaceDeviceStepState = (typeof REPLACE_DEVICE_STEP_STATES)[number];
declare function isValidReplaceDeviceStepState(state: unknown): state is ReplaceDeviceStepState;
declare const REPLACE_DEVICE_STEP_STATE: {
    [key: string]: ReplaceDeviceStepState;
};
interface State {
    icon?: SupportedIconsSuggestions;
    styleClass?: string;
}
type ReplaceDeviceStepStatesMap = {
    [key in ReplaceDeviceStepState]?: State;
};
declare const REPLACE_DEVICE_STEP_STATES_MAP: ReplaceDeviceStepStatesMap;

declare class ReplaceDeviceWizardService {
    private inventory;
    private identity;
    private audit;
    private event;
    private user;
    private appState;
    private alert;
    private static readonly NON_REENTRANT_STATES;
    get deviceToReplace$(): Observable<IManagedObject>;
    get replacementDeviceId$(): Observable<string>;
    externalIds$: Observable<IResultList<IExternalIdentity>>;
    externalIdsLoading$: Observable<boolean>;
    externalIdsWithSelection$: Observable<Array<{
        id: IExternalIdentity;
        selected: boolean;
    }>>;
    selectedExternalIds$: Observable<IExternalIdentity[]>;
    deviceReplaced$: Observable<boolean>;
    deviceReplacementInProgress$: Observable<boolean>;
    steps: ReplaceDeviceStep[];
    private deviceToReplaceSubject$;
    private deviceToReplaceObs$;
    private replacementDeviceIdSubject$;
    private replacementDeviceIdObs$;
    private checkExternalId$;
    private externalIdsLoadingSubject$;
    private triggerDeviceReplacementSubject$;
    private deviceReplacementInProgressSubject$;
    private queriesUtil;
    constructor(inventory: InventoryService, identity: IdentityService, audit: AuditService, event: EventService, user: UserService, appState: AppStateService, alert: AlertService);
    forDevice(deviceToReplace: IManagedObject): void;
    changeReplacementDeviceId(replacementDeviceId: string): void;
    checkExternalId(id: IExternalIdentity, checked: boolean): void;
    replaceDevice(): void;
    retryStep(step?: ReplaceDeviceStep): void;
    private defineSteps;
    private executeStep;
    private unwrapStepAction;
    private areExtIdsEqual;
    private extIdsToString;
    private toError;
    static ɵfac: i0.ɵɵFactoryDeclaration<ReplaceDeviceWizardService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ReplaceDeviceWizardService>;
}

declare class ReplaceDeviceWizardComponent implements GridConfigContextProvider {
    service: ReplaceDeviceWizardService;
    private deviceGridService;
    private modal;
    private drawerRef;
    private static readonly DEFAULT_VISIBLE_COLUMNS;
    REPLACE_DEVICE_STEP_STATES_MAP: ReplaceDeviceStepStatesMap;
    classes: string;
    stepper: C8yStepper;
    set deviceToReplace(deviceToReplace: IManagedObject);
    replacementDeviceId: string;
    baseQuery$: Observable<object>;
    columns: Column[];
    constructor(service: ReplaceDeviceWizardService, deviceGridService: DeviceGridService, modal: ModalService, drawerRef: BottomDrawerRef<ReplaceDeviceWizardComponent>);
    getGridConfigContext(): UserPreferencesGridConfigContext;
    replace(): Promise<void>;
    continue(): void;
    cancel(): void;
    close(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ReplaceDeviceWizardComponent, [null, null, null, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ReplaceDeviceWizardComponent, "c8y-replace-device-wizard", never, { "deviceToReplace": { "alias": "deviceToReplace"; "required": false; }; }, {}, never, never, true, never>;
}

export { REPLACE_DEVICE_STEP_STATE, REPLACE_DEVICE_STEP_STATES_MAP, ReplaceDeviceWizardComponent, ReplaceDeviceWizardService, isValidReplaceDeviceStepState };
export type { Error, ReplaceDeviceContext, ReplaceDeviceStep, ReplaceDeviceStepState, ReplaceDeviceStepStatesMap, State, StepInfo };
//# sourceMappingURL=index.d.ts.map
