import { WalletError } from '../sdk/WalletError';
import { ProviderCallHistory, ServiceCallHistory } from '../sdk/WalletServices.interfaces';
export declare class ServiceCollection<T> {
    serviceName: string;
    services: {
        name: string;
        service: T;
    }[];
    _index: number;
    /**
     * Start of currentCounts interval. Initially instance construction time.
     */
    readonly since: Date;
    _historyByProvider: Record<string, ProviderCallHistory>;
    constructor(serviceName: string, services?: {
        name: string;
        service: T;
    }[]);
    add(s: {
        name: string;
        service: T;
    }): ServiceCollection<T>;
    remove(name: string): void;
    get name(): string;
    get service(): T;
    getServiceToCall(i: number): ServiceToCall<T>;
    get serviceToCall(): ServiceToCall<T>;
    get allServicesToCall(): ServiceToCall<T>[];
    /**
     * Used to de-prioritize a service call by moving it to the end of the list.
     * @param stc
     */
    moveServiceToLast(stc: ServiceToCall<T>): void;
    get allServices(): T[];
    get count(): number;
    get index(): number;
    reset(): void;
    next(): number;
    clone(): ServiceCollection<T>;
    _addServiceCall(providerName: string, call: ServiceCall): ProviderCallHistory;
    getDuration(since: Date | string): number;
    addServiceCallSuccess(stc: ServiceToCall<T>, result?: string): void;
    addServiceCallFailure(stc: ServiceToCall<T>, result?: string): void;
    addServiceCallError(stc: ServiceToCall<T>, error: WalletError): void;
    /**
     * @returns A copy of current service call history
     */
    getServiceCallHistory(reset?: boolean): ServiceCallHistory;
}
export interface ServiceCall {
    /**
     * string value must be Date's toISOString format.
     */
    when: Date | string;
    msecs: number;
    /**
     * true iff service provider successfully processed the request
     * false iff service provider failed to process the request which includes thrown errors.
     */
    success: boolean;
    /**
     * Simple text summary of result. e.g. `not a valid utxo` or `valid utxo`
     */
    result?: string;
    /**
     * Error code and message iff success is false and a exception was thrown.
     */
    error?: {
        message: string;
        code: string;
    };
}
export interface ServiceToCall<T> {
    providerName: string;
    serviceName: string;
    service: T;
    call: ServiceCall;
}
//# sourceMappingURL=ServiceCollection.d.ts.map