import { AsyncCache } from '../async-cache';
import type { JwtPayload } from '../jsonwebtoken-type';
import type { AsyncCacheInterface } from '../async-cache';
import type { Destination } from './destination-service-types';
import type { DestinationsByType } from './destination-accessor-types';
import type { SubscriberToken } from './get-subscriber-token';
/**
 * Represents the isolation strategy in the destination cache.
 * The available strategies are isolation by tenant or isolation by tenant and user.
 */
export type IsolationStrategy = 'tenant' | 'tenant-user';
/**
 * Type to implement custom destination caching.
 * To use a custom cache, call {@link setDestinationCache} and pass a cache instance that implements this interface.
 */
export type DestinationCacheInterface = AsyncCacheInterface<Destination>;
/**
 * @internal
 * This wrapper class wraps methods of {@link Cache} class as asynchronous methods.
 */
export declare class DefaultDestinationCache extends AsyncCache<Destination> implements DestinationCacheInterface {
    constructor(defaultValidityTime?: number);
}
/**
 * @internal
 */
export interface DestinationCacheType {
    /**
     * @internal
     */
    retrieveDestinationFromCache: (token: Required<SubscriberToken> | JwtPayload | undefined, name: string, isolation: IsolationStrategy) => Promise<Destination | undefined>;
    /**
     * @internal
     */
    cacheRetrievedDestination: (token: Required<SubscriberToken> | JwtPayload | undefined, destination: Destination, isolation: IsolationStrategy) => Promise<void>;
    /**
     * @internal
     */
    cacheRetrievedDestinations: (token: Required<SubscriberToken> | JwtPayload | undefined, retrievedDestinations: DestinationsByType, isolation: IsolationStrategy) => Promise<void>;
    /**
     * @internal
     */
    clear: () => Promise<void>;
    /**
     * @internal
     */
    getCacheInstance: () => DestinationCacheInterface;
}
/**
 * DestinationCache constructor.
 * @param cache - Cache object which is used in DestinationCache
 * @returns A destination cache object.
 * @internal
 */
export declare const DestinationCache: (cache?: DestinationCacheInterface) => DestinationCacheType;
/**
 * Calculates a cache key based on the JWT and destination name for the given isolation strategy.
 * Cache keys for strategies are non-overlapping, i.e. using a cache key for strategy {@link 'tenant'}
 * will not result in a cache hit for a destination that has been cached with strategy {@link 'tenant-user'}.
 * @param decodedJwt - The decoded JWT of the current request.
 * @param destinationName - The name of the destination.
 * @param isolationStrategy - The strategy used to isolate cache entries.
 * @returns The cache key.
 * @internal
 */
export declare function getDestinationCacheKey(token: SubscriberToken | JwtPayload | undefined, destinationName: string, isolationStrategy?: IsolationStrategy): string | undefined;
/**
 * Sets the custom destination cache instance.
 * Call this method with an instance of {@link DestinationCacheInterface} to override the default cache instance set by the SDK.
 *
 * NOTE: This function should be called at the beginning before any calls to either {@link getDestination} or {@link @sap-cloud-sdk/http-client!executeHttpRequest}.
 * @param cache - An instance of {@link DestinationCacheInterface}.
 */
export declare function setDestinationCache(cache: DestinationCacheInterface): void;
/**
 * @internal
 */
export declare let destinationCache: DestinationCacheType;
/**
 * Determine the default isolation strategy if not given as option.
 * @param jwt - JWT to determine the default isolation strategy
 * @returns The isolation strategy based on the JWT. If no JWT is given it defaults to tenant isolation.
 * @internal
 */
export declare function getDefaultIsolationStrategy(jwt: JwtPayload | undefined): IsolationStrategy;
