import { OnDestroy } from '@angular/core';
import { Observable, ReplaySubject, Subject } from 'rxjs';
import { Net } from './net';
import { PetriNetResourceService } from '../resources/engine-endpoint/petri-net-resource.service';
import { LoggerService } from '../logger/services/logger.service';
import Transition from './transition';
import Transaction from './transaction';
import RolesAndPermissions from './rolesAndPermissions';
import { PetriNetReference } from '../resources/interface/petri-net-reference';
import { PetriNetReferenceWithPermissions } from './petri-net-reference-with-permissions';
import * as i0 from "@angular/core";
export interface NetCache {
    [k: string]: Net;
}
/**
 * Process service is responsible for loading and caching processes needed for any functionality of an app.
 */
export declare class ProcessService implements OnDestroy {
    private _petriNetResource;
    private _log;
    protected readonly _nets: NetCache;
    protected _netsSubject: Subject<NetCache>;
    protected _netUpdate: Subject<Net>;
    protected _requestCache: Map<string, ReplaySubject<Net>>;
    protected _referenceRequestCache: Map<string, ReplaySubject<PetriNetReferenceWithPermissions>>;
    readonly LATEST = "latest";
    constructor(_petriNetResource: PetriNetResourceService, _log: LoggerService);
    ngOnDestroy(): void;
    /**
     * Get process nets according to provided identifiers.
     * If any of the requested processes is not cached it will be loaded from the server and saved for later.
     * @param identifiers Array of identifiers of requested processes. See {@link Net}
     * @param forceLoad when set to `true` cached processes will be ignored and a backend request will always be made
     * (unless another is already pending)
     * @returns Observable of array of loaded processes. Array is emitted only when every process finished loading.
     * If any of the processes failed to load it is skipped from the result.
     */
    getNets(identifiers: Array<string>, forceLoad?: boolean): Observable<Array<Net>>;
    /**
     * Get process net by identifier.
     * @param identifier Identifier of the requested process. See {@link Net}
     * @param forceLoad when set to `true` cached processes will be ignored and a backend request will always be made
     * (unless another is already pending)
     * @returns Observable of [the process]{@link Net}. Process is loaded from a server or picked from the cache.
     */
    getNet(identifier: string, forceLoad?: boolean): Observable<Net>;
    /**
     * Get process net referencess according to provided identifiers.
     *
     * `PetriNetReferences` are not cached.
     * Each call will result in a new backend request unless a request for the same net is already pending.
     * @param identifiers Array of identifiers of requested processes. See {@link Net}
     * @returns Observable of array of loaded processes. Array is emitted only when every process finished loading.
     * If any of the processes failed to load it is skipped from the result.
     */
    getNetReferences(identifiers: Array<string>): Observable<Array<PetriNetReferenceWithPermissions>>;
    /**
     * Get process net reference by identifier.
     *
     * `PetriNetReferences` are not cached.
     * Each call will result in a new backend request unless a request for the same net is already pending.
     * @param identifier Identifier of the requested process. See {@link Net}
     * @returns Observable of [the process]{@link Net}. Process is loaded from a server or picked from the cache.
     */
    getNetReference(identifier: string): Observable<PetriNetReferenceWithPermissions>;
    /**
     * Remove cached process by identifier. If the process is not found nothing happens.
     * @param identifier Process identifier
     */
    removeNet(identifier: string): void;
    /**
     * Update cached process object. If the process is not found nothing happens. Process object is replaced.
     * @param net Updated process object.
     */
    updateNet(net: Net): void;
    /**
     * Stream of change of the process cache.
     * New state of cache is emitted every time the cached changed by inserting, updating or deleting a process.
     * @returns Observable of whole updated cache.
     */
    get nets$(): Observable<NetCache>;
    /**
     * Stream of change in the process cache.
     * New state of cache is emitted every time the cached changed by inserting, updating or deleting a process.
     * @returns Observable of updated or newly loaded process net.
     */
    get netUpdate$(): Observable<Net>;
    areNetsLoaded(identifiers: Array<string>): boolean;
    isNetLoaded(identifier: string): boolean;
    protected loadNet(id: string): Observable<Net>;
    protected loadNetReference(id: string): Observable<PetriNetReference>;
    protected loadTransitions(id: string): Observable<Array<Transition>>;
    protected loadTransactions(id: string): Observable<Array<Transaction>>;
    protected loadRoles(id: string): Observable<RolesAndPermissions>;
    protected publishUpdate(net?: Net): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ProcessService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ProcessService>;
}
