import { Logger } from 'winston';
import { Config } from '@backstage/config';
import { PluginCacheManager, PluginDatabaseManager, PluginEndpointDiscovery, TokenManager, UrlReader } from '@backstage/backend-common';
import { Router } from 'express';
import { PluginTaskScheduler, TaskRunner } from '@backstage/backend-tasks';
import { IdentityApi } from '@backstage/plugin-auth-node';
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
import { EventBroker, EventsService, HttpPostIngressOptions } from '@backstage/plugin-events-node';
import { BackendFeature } from '@backstage/backend-plugin-api';
import { PackagePlatform, PackageRole } from '@backstage/cli-node';
import { CatalogBuilder } from '@backstage/plugin-catalog-backend';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
import { IndexBuilder } from '@backstage/plugin-search-backend-node';
import { EventsBackend } from '@backstage/plugin-events-backend';
import { PermissionPolicy } from '@backstage/plugin-permission-node';
/**
 * @public
 *
 * @deprecated
 *
 * Support for the legacy backend system will be removed in the future.
 *
 * When adding a legacy plugin installer entrypoint in your plugin,
 * you should always take the opportunity to also implement support
 * for the new backend system if not already done.
 *
 */
export type LegacyPluginEnvironment = {
    logger: Logger;
    cache: PluginCacheManager;
    database: PluginDatabaseManager;
    config: Config;
    reader: UrlReader;
    discovery: PluginEndpointDiscovery;
    tokenManager: TokenManager;
    permissions: PermissionEvaluator;
    scheduler: PluginTaskScheduler;
    identity: IdentityApi;
    eventBroker: EventBroker;
    events: EventsService;
    pluginProvider: BackendPluginProvider;
};
/**
 * @public
 */
export interface DynamicPluginProvider extends FrontendPluginProvider, BackendPluginProvider {
    plugins(): DynamicPlugin[];
}
/**
 * @public
 */
export interface BackendPluginProvider {
    backendPlugins(): BackendDynamicPlugin[];
}
/**
 * @public
 */
export interface FrontendPluginProvider {
    frontendPlugins(): FrontendDynamicPlugin[];
}
/**
 * @public
 */
export interface BaseDynamicPlugin {
    name: string;
    version: string;
    role: PackageRole;
    platform: PackagePlatform;
}
/**
 * @public
 */
export type DynamicPlugin = FrontendDynamicPlugin | BackendDynamicPlugin;
/**
 * @public
 */
export interface FrontendDynamicPlugin extends BaseDynamicPlugin {
    platform: 'web';
}
/**
 * @public
 */
export interface BackendDynamicPlugin extends BaseDynamicPlugin {
    platform: 'node';
    installer: BackendDynamicPluginInstaller;
}
/**
 * @public
 */
export type BackendDynamicPluginInstaller = LegacyBackendPluginInstaller | NewBackendPluginInstaller;
/**
 * @public
 */
export interface NewBackendPluginInstaller {
    kind: 'new';
    install(): BackendFeature | BackendFeature[];
}
/**
 * @public
 * @deprecated
 *
 * Support for the legacy backend system will be removed in the future.
 *
 * When adding a legacy plugin installer entrypoint in your plugin,
 * you should always take the opportunity to also implement support
 * for the new backend system if not already done.
 *
 */
export interface LegacyBackendPluginInstaller {
    kind: 'legacy';
    router?: {
        pluginID: string;
        createPlugin(env: LegacyPluginEnvironment): Promise<Router>;
    };
    catalog?(builder: CatalogBuilder, env: LegacyPluginEnvironment): void;
    scaffolder?(env: LegacyPluginEnvironment): TemplateAction<any>[];
    search?(indexBuilder: IndexBuilder, schedule: TaskRunner, env: LegacyPluginEnvironment): void;
    events?(eventsBackend: EventsBackend, env: LegacyPluginEnvironment): HttpPostIngressOptions[];
    permissions?: {
        policy?: PermissionPolicy;
    };
}
/**
 * @public
 */
export declare function isBackendDynamicPluginInstaller(obj: any): obj is BackendDynamicPluginInstaller;
