import type * as client from '@botpress/client';
import type * as sdk from '@botpress/sdk';
import type { YargsConfig } from '@bpinternal/yargs-extra';
import * as apiUtils from '../api';
import * as config from '../config';
import * as consts from '../consts';
import type { CommandArgv, CommandDefinition } from '../typings';
import * as utils from '../utils';
import { GlobalCommand } from './global-command';
export type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>;
export type ProjectCache = {
    botId: string;
    devId: string;
    tunnelId: string;
};
type ConfigurableProjectPaths = {
    workDir: string;
};
type ConstantProjectPaths = typeof consts.fromWorkDir;
type AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths;
type LintIgnoredConfig = {
    bpLintDisabled?: boolean;
};
export type ProjectType = ProjectDefinition['type'];
export type ProjectDefinition = LintIgnoredConfig & ({
    type: 'integration';
    definition: sdk.IntegrationDefinition;
} | {
    type: 'interface';
    definition: sdk.InterfaceDefinition;
} | {
    type: 'bot';
    definition: sdk.BotDefinition;
} | {
    type: 'plugin';
    definition: sdk.PluginDefinition;
});
type ProjectDefinitionResolver<T> = () => Promise<LintIgnoredConfig & T>;
export type ProjectDefinitionLazy = {
    projectType: 'integration';
    resolveProjectDefinition: ProjectDefinitionResolver<{
        type: 'integration';
        definition: sdk.IntegrationDefinition;
    }>;
} | {
    projectType: 'bot';
    resolveProjectDefinition: ProjectDefinitionResolver<{
        type: 'bot';
        definition: sdk.BotDefinition;
    }>;
} | {
    projectType: 'interface';
    resolveProjectDefinition: ProjectDefinitionResolver<{
        type: 'interface';
        definition: sdk.InterfaceDefinition;
    }>;
} | {
    projectType: 'plugin';
    resolveProjectDefinition: ProjectDefinitionResolver<{
        type: 'plugin';
        definition: sdk.PluginDefinition;
    }>;
};
type UpdatedBot = client.Bot;
declare class ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {
    constructor(argv: CommandArgv<ProjectCommandDefinition>);
}
export declare class ProjectDefinitionContext {
    private _codeCache;
    private _buildContext;
    getOrResolveDefinition<T extends object>(code: string): T;
    rebuildEntrypoint(...args: Parameters<utils.esbuild.BuildEntrypointContext['rebuild']>): Promise<utils.esbuild.BuildResult<utils.esbuild.BuildOptions>>;
}
export declare abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {
    protected projectContext: ProjectDefinitionContext;
    setProjectContext(projectContext: ProjectDefinitionContext): this;
    protected bootstrap(): Promise<void>;
    protected get projectPaths(): ProjectPaths;
    protected get projectCache(): utils.cache.FSKeyValueCache<ProjectCache>;
    private _readProjectType;
    protected readProjectDefinitionFromFS(): ProjectDefinitionLazy;
    private _readIntegrationDefinitionFromFS;
    private _readInterfaceDefinitionFromFS;
    private _readBotDefinitionFromFS;
    private _readPluginDefinitionFromFS;
    private _isBpLintDisabled;
    protected displayWebhookUrls(bot: client.Bot): void;
    protected promptSecrets(integrationDef: sdk.IntegrationDefinition, argv: YargsConfig<typeof config.schemas.secrets>, opts?: {
        formatEnv?: boolean;
        knownSecrets?: string[];
    }): Promise<Record<string, string | null>>;
    protected prepareCreateIntegrationBody(integrationDef: sdk.IntegrationDefinition): Promise<apiUtils.CreateIntegrationRequestBody>;
    protected prepareBotDependencies(botDef: sdk.BotDefinition, api: apiUtils.ApiClient): Promise<Partial<apiUtils.UpdateBotRequestBody>>;
    protected prepareIntegrationDependencies(integrationDef: sdk.IntegrationDefinition, api: apiUtils.ApiClient): Promise<Partial<apiUtils.CreateIntegrationRequestBody>>;
    protected preparePluginDependencies(pluginDef: sdk.PluginDefinition, api: apiUtils.ApiClient): Promise<Partial<apiUtils.CreatePluginRequestBody>>;
    private _fetchDependencies;
    protected readProjectFile: (filePath: string | undefined, encoding?: BufferEncoding) => Promise<string | undefined>;
    private _parseArgvSecrets;
    private _notifyUpdateSdk;
    protected validateIntegrationRegistration(updatedBot: UpdatedBot, onFailCallback: (failedIntegrations: UpdatedBot['integrations']) => void): void;
}
export {};
