import { AnalyticsApi, ApiFactory, ConfigApi, DiscoveryApi, IdentityApi, StorageApi } from '@backstage/core-plugin-api';
import { TranslationApi } from '@backstage/core-plugin-api/alpha';
import { AuthorizeResult, EvaluatePermissionRequest } from '@backstage/plugin-permission-common';
import { PermissionApi } from '@backstage/plugin-permission-react';
import { JsonObject } from '@backstage/types';
import { ApiMock } from './ApiMock';
/**
 * Mock implementations of the core utility APIs, to be used in tests.
 *
 * @public
 * @remarks
 *
 * There are some variations among the APIs depending on what needs tests
 * might have, but overall there are three main usage patterns:
 *
 * 1: Creating an actual fake API instance, often with a simplified version
 * of functionality, by calling the mock API itself as a function.
 *
 * ```ts
 * // The function often accepts parameters that control its behavior
 * const foo = mockApis.foo();
 * ```
 *
 * 2: Creating a mock API, where all methods are replaced with jest mocks, by
 * calling the API's `mock` function.
 *
 * ```ts
 * // You can optionally supply a subset of its methods to implement
 * const foo = mockApis.foo.mock({
 *   someMethod: () => 'mocked result',
 * });
 * // After exercising your test, you can make assertions on the mock:
 * expect(foo.someMethod).toHaveBeenCalledTimes(2);
 * expect(foo.otherMethod).toHaveBeenCalledWith(testData);
 * ```
 *
 * 3: Creating an API factory that behaves similarly to the mock as per above.
 *
 * ```ts
 * const factory = mockApis.foo.factory({
 *   someMethod: () => 'mocked result',
 * });
 * ```
 */
export declare namespace mockApis {
    /**
     * Mock implementation of {@link @backstage/core-plugin-api#AnalyticsApi}.
     *
     * @public
     */
    function analytics(): AnalyticsApi;
    /**
     * Mock implementations of {@link @backstage/core-plugin-api#AnalyticsApi}.
     *
     * @public
     */
    namespace analytics {
        const factory: () => ApiFactory<AnalyticsApi, AnalyticsApi, {}>;
        const mock: (partialImpl?: Partial<AnalyticsApi> | undefined) => ApiMock<AnalyticsApi>;
    }
    /**
     * Fake implementation of {@link @backstage/core-plugin-api#ConfigApi}
     * with optional data supplied.
     *
     * @public
     * @example
     *
     * ```tsx
     * const config = mockApis.config({
     *   data: { app: { baseUrl: 'https://example.com' } },
     * });
     *
     * await renderInTestApp(
     *   <TestApiProvider apis={[[configApiRef, config]]}>
     *     <MyTestedComponent />
     *   </TestApiProvider>,
     * );
     * ```
     */
    function config(options?: {
        data?: JsonObject;
    }): ConfigApi;
    /**
     * Mock helpers for {@link @backstage/core-plugin-api#ConfigApi}.
     *
     * @see {@link @backstage/core-plugin-api#mockApis.config}
     * @public
     */
    namespace config {
        /**
         * Creates a factory for a fake implementation of
         * {@link @backstage/core-plugin-api#ConfigApi} with optional
         * configuration data supplied.
         *
         * @public
         */
        const factory: (options?: {
            data?: JsonObject;
        } | undefined) => ApiFactory<import("@backstage/config").Config, import("@backstage/config").Config, {}>;
        /**
         * Creates a mock implementation of
         * {@link @backstage/core-plugin-api#ConfigApi}. All methods are
         * replaced with jest mock functions, and you can optionally pass in a
         * subset of methods with an explicit implementation.
         *
         * @public
         */
        const mock: (partialImpl?: Partial<import("@backstage/config").Config> | undefined) => ApiMock<import("@backstage/config").Config>;
    }
    /**
     * Fake implementation of {@link @backstage/core-plugin-api#DiscoveryApi}. By
     * default returns URLs on the form `http://example.com/api/<pluginIs>`.
     *
     * @public
     */
    function discovery(options?: {
        baseUrl?: string;
    }): DiscoveryApi;
    /**
     * Mock implementations of {@link @backstage/core-plugin-api#DiscoveryApi}.
     *
     * @public
     */
    namespace discovery {
        const factory: (options?: {
            baseUrl?: string;
        } | undefined) => ApiFactory<DiscoveryApi, DiscoveryApi, {}>;
        const mock: (partialImpl?: Partial<DiscoveryApi> | undefined) => ApiMock<DiscoveryApi>;
    }
    /**
     * Fake implementation of {@link @backstage/core-plugin-api#IdentityApi}. By
     * default returns no token or profile info, and the user `user:default/test`.
     *
     * @public
     */
    function identity(options?: {
        userEntityRef?: string;
        ownershipEntityRefs?: string[];
        token?: string;
        email?: string;
        displayName?: string;
        picture?: string;
    }): IdentityApi;
    /**
     * Mock implementations of {@link @backstage/core-plugin-api#IdentityApi}.
     *
     * @public
     */
    namespace identity {
        const factory: (options?: {
            userEntityRef?: string;
            ownershipEntityRefs?: string[];
            token?: string;
            email?: string;
            displayName?: string;
            picture?: string;
        } | undefined) => ApiFactory<IdentityApi, IdentityApi, {}>;
        const mock: (partialImpl?: Partial<IdentityApi> | undefined) => ApiMock<IdentityApi>;
    }
    /**
     * Fake implementation of
     * {@link @backstage/plugin-permission-react#PermissionApi}. By default allows
     * all actions.
     *
     * @public
     */
    function permission(options?: {
        authorize?: AuthorizeResult.ALLOW | AuthorizeResult.DENY | ((request: EvaluatePermissionRequest) => AuthorizeResult.ALLOW | AuthorizeResult.DENY);
    }): PermissionApi;
    /**
     * Mock implementation of
     * {@link @backstage/plugin-permission-react#PermissionApi}.
     *
     * @public
     */
    namespace permission {
        const factory: (options?: {
            authorize?: AuthorizeResult.ALLOW | AuthorizeResult.DENY | ((request: EvaluatePermissionRequest) => AuthorizeResult.ALLOW | AuthorizeResult.DENY);
        } | undefined) => ApiFactory<PermissionApi, PermissionApi, {}>;
        const mock: (partialImpl?: Partial<PermissionApi> | undefined) => ApiMock<PermissionApi>;
    }
    /**
     * Fake implementation of {@link @backstage/core-plugin-api#StorageApi}.
     * Stores data temporarily in memory.
     *
     * @public
     */
    function storage(options?: {
        data?: JsonObject;
    }): StorageApi;
    /**
     * Mock implementations of {@link @backstage/core-plugin-api#StorageApi}.
     *
     * @public
     */
    namespace storage {
        const factory: (options?: {
            data?: JsonObject;
        } | undefined) => ApiFactory<StorageApi, StorageApi, {}>;
        const mock: (partialImpl?: Partial<StorageApi> | undefined) => ApiMock<StorageApi>;
    }
    /**
     * Fake implementation of {@link @backstage/core-plugin-api/alpha#TranslationApi}.
     * By default returns the default translation.
     *
     * @public
     */
    function translation(): TranslationApi;
    /**
     * Mock implementations of {@link @backstage/core-plugin-api/alpha#TranslationApi}.
     *
     * @public
     */
    namespace translation {
        const factory: () => ApiFactory<TranslationApi, TranslationApi, {}>;
        const mock: (partialImpl?: Partial<TranslationApi> | undefined) => ApiMock<TranslationApi>;
    }
}
