import { REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC } from '@redocly/config';
import type { JSX } from 'react';
import type { JSONSchemaType } from '@redocly/ajv';
import type { Node } from '@markdoc/markdoc';
import type { ProductConfig, SearchDocument, SearchFacet } from '@redocly/theme';
import type { GlobalData, Feature } from '../../../types/index.js';
import type { RbacScopeItems, RedirectConfig, RedoclyConfig, ServerPropsContext, ServerPropsRequest, PageProps, PageStaticData, NavItem, ResolvedNavItem, Version, MdOptions } from '@redocly/config';
import type { LoaderFn } from '../fs';
import type { MarkdocDeps } from './markdown';
import type { BundledDefinition } from '../../plugins/openapi-docs/load-definition';
import type { Cache } from '../../fs/cache';
import type { ContentFs } from '../../fs/content-fs';
import type { SearchEngine } from '../../plugins/search/engines/search-engine';
import type { Logger } from '../../utils/reporter/logger';
import type { AiDocumentsStore } from '../../plugins/search/types';
export type ResolveItemsOptions = {
    groupCustomSidebars?: boolean;
    locale?: string;
    ignoredRoutes?: Set<string>;
    ref?: string;
    ignoreCustomSidebar?: boolean;
    navFile: string;
};
export type GetStaticDataContext = {
    getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
    getRouteBySlug: (relativePath: string, opts?: {
        followRedirect: boolean;
    }) => PageRouteDetails | undefined;
    getGlobalConfig<T = unknown>(key: string): T | undefined;
    getConfig: () => RedoclyConfig;
    getAllRoutes: () => PageRouteDetails[];
    getAllApiRoutes: () => ApiFunctionRoute[];
    getLoginUrls: () => Record<string, string>;
    parseMarkdoc: (input: MarkdownParseInput, context: LifecycleContext, deps?: MarkdocDeps) => Promise<{
        ast: Node;
        info: any;
        compoundHash: string;
    }>;
    getAllRoutesForLocale: (locale?: string) => PageRouteDetails[];
    contentDir: string;
    outdir: string;
};
export type GetStaticDataFn<TRoute, TData> = (route: TRoute, context: GetStaticDataContext) => Promise<TData>;
export type GetServerPropsContext = {
    getConfig: () => RedoclyConfig;
    getGlobalConfig<T = unknown>(key: string): T | undefined;
    getGlobalData: () => GlobalData;
    serverOutDir: string;
};
export type GetServerPropsFn<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> = (route: PageRouteDetails<TData, TProps>, data: TData, mdOptions: MdOptions, serverOutDir?: string) => Promise<TProps>;
export type GetPagePropsFn<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> = (data: TData, request: ServerPropsRequest, context: ServerPropsContext) => Promise<TProps>;
export interface RouteDetails<TRoute = any, TData extends PageStaticData = PageStaticData> {
    slug: string;
    fsPath?: string;
    [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
    [REDOCLY_ROUTE_RBAC]?: {
        slug?: string;
        fsPath?: string;
    };
    getStaticData?: GetStaticDataFn<TRoute, TData>;
    metadata?: Record<string, unknown>;
    getNavText?: () => Promise<string> | string;
}
export interface PageRouteDetails<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> extends RouteDetails<PageRouteDetails<TData, TProps>, TData> {
    fsPath: string;
    baseSlug: string;
    templateId: string;
    hasClientRoutes?: boolean;
    versions?: Version[];
    product?: ProductConfig;
    httpVerb?: string;
    path?: string;
    getNavText?: () => Promise<string> | string;
    getSidebar?(route: PageRouteDetails, item?: NavItem): ResolvedNavItem[];
    getSearchDocuments?(route: PageRouteDetails, staticData: TData, actions: AfterRoutesCreatedActions): Promise<SearchDocument[]>;
    getAiDocumentsStore?(route: PageRouteDetails, staticData: TData, context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions): Promise<AiDocumentsStore | undefined>;
    serverPropsGetterIds?: string[];
    excludeFromSidebar?: boolean;
    [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
    [REDOCLY_ROUTE_RBAC]?: {
        slug?: string;
        fsPath?: string;
    };
}
export type PageRouteInit = Omit<PageRouteDetails, 'versions' | 'slug' | 'product' | 'baseSlug' | typeof REDOCLY_ROUTE_RBAC> & {
    slug?: string;
    duplicateInAllLocales?: boolean;
    slugSuffix?: string;
    sharedData?: Array<{
        id: string;
        key: string;
    }>;
    redirectFrom?: Array<{
        type: number;
        from: string;
    }>;
};
export type ApiFunctionRouteMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'all';
export type ApiFunctionRoute = RouteDetails & {
    httpMethod: ApiFunctionRouteMethod;
    requestHandlerId: string;
};
export interface MiddlewareDetails {
    id: string;
    importPath: string;
}
export interface PathVersionInfo {
    version: string;
    isDefault: boolean;
    versionFolderId: string;
}
export interface ProcessContentActions {
    createSharedData(id: string, data: unknown, hash?: string): Promise<string>;
    addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
    addRouteSharedDataToAllLocales(slug: string, dataKey: string, dataId: string): void;
    loadOpenApiDefinitions(context: LifecycleContext): Promise<BundledDefinition[]>;
    setGlobalConfig: (data: Record<string, unknown>) => void;
    setGlobalData: (data: GlobalData) => void;
    getConfig: () => RedoclyConfig;
    parseMarkdoc: (input: MarkdownParseInput, context: LifecycleContext, deps?: MarkdocDeps) => Promise<{
        ast: Node;
        info: any;
        compoundHash: string;
    }>;
    setSearchFacets: (facets: Map<string, SearchFacet>) => void;
    getSearchFacets: () => Map<string, SearchFacet>;
    addRoute: (route: PageRouteInit) => void;
    addApiRoute: (route: ApiFunctionRoute) => void;
    createRequestHandler: (id: string, importPath: string) => void;
    addRedirect: (from: string, to: RedirectConfig) => void;
    createTemplate: (id: string, importPath: string) => string;
    addBrowserPlugin: (importPath: string) => void;
    registerServerPropsGetter: (id: string, importPath: string) => string;
    registerPagePropsGetter: (id: string, importPath: string) => void;
    addSsrComponents: (components: JSX.Element[] | string[], position: 'head' | 'preBody' | 'postBody') => void;
    contentDir: string;
    outdir: string;
}
export interface AfterRoutesCreatedActions {
    createSharedData(id: string, data: unknown, hash?: string): Promise<string>;
    addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
    getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
    getRouteBySlug: (relativePath: string, opts?: {
        followRedirect: boolean;
    }) => PageRouteDetails | undefined;
    getConfig: () => RedoclyConfig;
    getGlobalConfig<T = unknown>(key: string): T | undefined;
    getAllRoutes: () => PageRouteDetails[];
    getAllRoutesForLocale: (locale?: string) => PageRouteDetails[];
    getAllApiRoutes: () => ApiFunctionRoute[];
    getLoginUrls: () => Record<string, string>;
    setGlobalData: (data: GlobalData) => void;
    getGlobalData: () => GlobalData;
    setGlobalConfig: (data: Record<string, unknown>) => void;
    parseMarkdoc: (input: MarkdownParseInput, context: LifecycleContext, deps?: MarkdocDeps) => Promise<{
        ast: Node;
        info: any;
        compoundHash: string;
    }>;
    setSearchFacets: (facets: Map<string, SearchFacet>) => void;
    getSearchFacets: () => Map<string, SearchFacet>;
    setSearchEngine: (engine: SearchEngine) => void;
    addRedirect: (from: string, to: RedirectConfig) => void;
    contentDir: string;
    outdir: string;
    serverOutDir: string;
    hasSitemap: boolean;
    addBrowserPlugin: (importPath: string) => void;
    addSsrComponents: (components: JSX.Element[] | string[], position: 'head' | 'preBody' | 'postBody') => void;
    addApiRoute: (route: ApiFunctionRoute) => void;
    loadOpenApiDefinitions(context: LifecycleContext): Promise<BundledDefinition[]>;
}
export type LifecycleContext = {
    fs: ContentFs;
    cache: Cache;
    getConfig: (dirPath?: string) => Promise<RedoclyConfig & {
        configPath?: string;
        realConfigPath?: string;
    }>;
    isPathIgnored: (relativePath: string) => Promise<boolean>;
    withPathPrefix: (url: string) => string;
    logger: Logger;
};
export type AfterRoutesCreatedLifecycleContext = LifecycleContext & {
    slugify: (relativePath: string) => string;
};
export type MarkdownParseInput = {
    relativePath: string;
    cacheId?: string;
    isVirtual?: boolean;
    content?: string;
};
type ProcessContentFn = (actions: ProcessContentActions, context: LifecycleContext) => Promise<void> | void;
type AfterRoutesCreatedFn = (actions: AfterRoutesCreatedActions, context: AfterRoutesCreatedLifecycleContext) => Promise<void> | void;
export type ExternalPlugin = {
    id: string;
    processContent?: ProcessContentFn;
    afterRoutesCreated?: AfterRoutesCreatedFn;
    loaders?: Record<string, LoaderFn>;
    requiredEntitlements?: Feature[];
    ssoConfigSchema?: JSONSchemaType<any>;
    redoclyConfigSchema?: JSONSchemaType<any>;
    ejectIgnore?: string[];
};
export type DeprecatedCliPlugin = {
    default: {
        id: string;
    };
};
export type ImportedPlugin = {
    default?: ExternalPluginCreator | {
        default?: ExternalPluginCreator;
    };
} | DeprecatedCliPlugin;
export type ExternalPluginCreator = (options: PluginOptions) => ExternalPlugin | Promise<ExternalPlugin>;
export type LifecyclePluginInstance = {
    id: string;
    processContent?: ProcessContentFn;
    afterRoutesCreated?: AfterRoutesCreatedFn;
    loaders?: Record<string, LoaderFn>;
    requiredEntitlements?: Feature[];
};
export type LifecyclePluginCreator = (options: PluginOptions) => Promise<LifecyclePluginInstance> | LifecyclePluginInstance;
export interface PluginDefaultOptions {
    contentDir: string;
}
export type PluginOptions = PluginDefaultOptions & {
    [k: string]: unknown;
};
export interface CookieOptions {
    domain?: string;
    expires?: Date;
    httpOnly?: boolean;
    maxAge?: number;
    path?: string;
    secure?: boolean;
    signed?: boolean;
    sameSite?: 'Strict' | 'Lax' | 'None';
}
export {};
//# sourceMappingURL=common.d.ts.map