import { Entity } from '@backstage/catalog-model';
import { IconComponent } from '@backstage/core-plugin-api';
import { CatalogApi, EntityPresentationApi, EntityRefPresentation, EntityRefPresentationSnapshot } from '@backstage/plugin-catalog-react';
import { HumanDuration } from '@backstage/types';
/**
 * A custom renderer for the {@link DefaultEntityPresentationApi}.
 *
 * @public
 */
export interface DefaultEntityPresentationApiRenderer {
    /**
     * Whether to request the entity from the catalog API asynchronously.
     *
     * @remarks
     *
     * If this is set to true, entity data will be streamed in from the catalog
     * whenever needed, and the render function may be called more than once:
     * first when no entity data existed (or with old cached data), and then again
     * at a later point when data is loaded from the catalog that proved to be
     * different from the old one.
     *
     * @defaultValue true
     */
    async?: boolean;
    /**
     * The actual render function.
     *
     * @remarks
     *
     * This function may be called multiple times.
     *
     * The loading flag signals that the framework MAY be trying to load more
     * entity data from the catalog and call the render function again, if it
     * succeeds. In some cases you may want to render a loading state in that
     * case.
     *
     * The entity may or may not be given. If the caller of the presentation API
     * did present an entity upfront, then that's what will be passed in here.
     * Otherwise, it may be a server-side entity that either comes from a local
     * cache or directly from the server.
     *
     * In either case, the renderer should return a presentation that is the most
     * useful possible for the end user, given the data that is available.
     */
    render: (options: {
        entityRef: string;
        loading: boolean;
        entity: Entity | undefined;
        context: {
            defaultKind?: string;
            defaultNamespace?: string;
        };
    }) => {
        snapshot: Omit<EntityRefPresentationSnapshot, 'entityRef'>;
    };
}
/**
 * Options for the {@link DefaultEntityPresentationApi}.
 *
 * @public
 */
export interface DefaultEntityPresentationApiOptions {
    /**
     * The catalog API to use. If you want to use any asynchronous features, you
     * must supply one.
     */
    catalogApi?: CatalogApi;
    /**
     * When to expire entities that have been loaded from the catalog API and
     * cached for a while.
     *
     * @defaultValue 10 seconds
     * @remarks
     *
     * The higher this value, the lower the load on the catalog API, but also the
     * higher the risk of users seeing stale data.
     */
    cacheTtl?: HumanDuration;
    /**
     * For how long to wait before sending a batch of entity references to the
     * catalog API.
     *
     * @defaultValue 50 milliseconds
     * @remarks
     *
     * The higher this value, the greater the chance of batching up requests from
     * across a page, but also the longer the lag time before displaying accurate
     * information.
     */
    batchDelay?: HumanDuration;
    /**
     * A mapping from kinds to icons.
     *
     * @remarks
     *
     * The keys are kinds (case insensitive) that map to icon values to represent
     * kinds by. These are merged with the default set of icons.
     */
    kindIcons?: Record<string, IconComponent>;
    /**
     * A custom renderer, if any.
     */
    renderer?: DefaultEntityPresentationApiRenderer;
}
/**
 * Default implementation of the {@link @backstage/plugin-catalog-react#EntityPresentationApi}.
 *
 * @public
 */
export declare class DefaultEntityPresentationApi implements EntityPresentationApi {
    #private;
    /**
     * Creates a new presentation API that does not reach out to the catalog.
     */
    static createLocal(): EntityPresentationApi;
    /**
     * Creates a new presentation API that calls out to the catalog as needed to
     * get additional information about entities.
     */
    static create(options: DefaultEntityPresentationApiOptions): EntityPresentationApi;
    private constructor();
    /** {@inheritdoc @backstage/plugin-catalog-react#EntityPresentationApi.forEntity} */
    forEntity(entityOrRef: Entity | string, context?: {
        defaultKind?: string;
        defaultNamespace?: string;
    }): EntityRefPresentation;
}
