import * as cdk from "aws-cdk-lib";
import { ILayerVersion } from "aws-cdk-lib/aws-lambda";
import * as cxapi from "aws-cdk-lib/cx-api";
import { Bootstrap } from "@serverless-stack/core";
import { FunctionProps, FunctionHandlerProps } from "./Function.js";
import { BaseSiteEnvironmentOutputsInfo } from "./BaseSite.js";
import { Permissions } from "./util/permission.js";
import { StackProps } from "./Stack.js";
import { FunctionalStack } from "./FunctionalStack.js";
/**
 * @internal
 */
export interface AppDeployProps {
    /**
     * The app name, used to prefix stacks.
     *
     * @default - Defaults to empty string
     */
    readonly name?: string;
    /**
     * The stage to deploy this app to.
     *
     * @default - Defaults to dev
     */
    readonly stage?: string;
    /**
     * The region to deploy this app to.
     *
     * @default - Defaults to us-east-1
     */
    readonly region?: string;
    readonly buildDir?: string;
    readonly skipBuild?: boolean;
    readonly esbuildConfig?: string;
    readonly bootstrapAssets?: Bootstrap.Assets;
    readonly debugEndpoint?: string;
    readonly debugBucketArn?: string;
    readonly debugBucketName?: string;
    readonly debugStartedAt?: number;
    readonly debugBridge?: string;
    readonly debugIncreaseTimeout?: boolean;
    /**
     * The callback after synth completes, used by `sst start`.
     *
     * @default - Defaults to undefined
     */
    readonly synthCallback?: (lambdaHandlers: FunctionHandlerProps[], siteEnvironments: BaseSiteEnvironmentOutputsInfo[]) => void;
}
declare type AppRemovalPolicy = Lowercase<keyof typeof cdk.RemovalPolicy>;
export declare type AppProps = cdk.AppProps;
/**
 * The App construct extends cdk.App and is used internally by SST.
 */
export declare class App extends cdk.App {
    /**
     * Whether or not the app is running locally under `sst start`
     */
    readonly local: boolean;
    /**
     * The name of your app, comes from the `name` in your `sst.json`
     */
    readonly name: string;
    /**
     * The stage the app is being deployed to. If this is not specified as the --stage option, it'll default to the stage configured during the initial run of the SST CLI.
     */
    readonly stage: string;
    /**
     * The region the app is being deployed to. If this is not specified as the --region option in the SST CLI, it'll default to the region in your sst.json.
     */
    readonly region: string;
    /**
     * The AWS account the app is being deployed to. This comes from the IAM credentials being used to run the SST CLI.
     */
    readonly account: string;
    /** @internal */
    readonly buildDir: string;
    /** @internal */
    readonly esbuildConfig?: string;
    /** @internal */
    readonly bootstrapAssets: Bootstrap.Assets;
    /** @internal */
    readonly debugBridge?: string;
    /** @internal */
    readonly debugEndpoint?: string;
    /** @internal */
    readonly debugBucketArn?: string;
    /** @internal */
    readonly debugBucketName?: string;
    /** @internal */
    readonly debugStartedAt?: number;
    /** @internal */
    readonly debugIncreaseTimeout?: boolean;
    /** @internal */
    readonly appPath: string;
    /** @internal */
    defaultFunctionProps: (FunctionProps | ((stack: cdk.Stack) => FunctionProps))[];
    private _defaultRemovalPolicy?;
    /** @internal */
    get defaultRemovalPolicy(): "destroy" | "retain" | "snapshot" | undefined;
    /**
     * The callback after synth completes.
     */
    private readonly synthCallback?;
    /**
     * A list of Lambda functions in the app
     */
    private readonly lambdaHandlers;
    private readonly siteEnvironments;
    /**
     * Skip building Function code
     * Note that on `sst remove`, we do not want to bundle the Lambda functions.
     *      CDK disables bundling (ie. zipping) for `cdk destroy` command.
     *      But SST runs `cdk synth` first then manually remove each stack. Hence
     *      we cannot rely on CDK to disable bundling, and we disable it manually.
     *      This allows us to disable BOTH building and bundling, where as CDK
     *      would only disable the latter. For example, `cdk destroy` still trys
     *      to install Python dependencies in Docker.
     *
     * @internal
     */
    readonly skipBuild: boolean;
    /**
     * @internal
     */
    constructor(deployProps?: AppDeployProps, props?: AppProps);
    /**
     * Use this method to prefix resource names in your stacks to make sure they don't thrash when deployed to different stages in the same AWS account. This method will prefix a given resource name with the stage and app name. Using the format `${stage}-${name}-${logicalName}`.
     * @example
     * ```js
     * console.log(app.logicalPrefixedName("myTopic"));
     *
     * // dev-my-app-myTopic
     * ```
     */
    logicalPrefixedName(logicalName: string): string;
    /**
     * The default removal policy that'll be applied to all the resources in the app. This can be useful to set ephemeral (dev or feature branch) environments to remove all the resources on deletion.
     * :::danger
     * Make sure to not set the default removal policy to `DESTROY` for production environments.
     * :::
     * @example
     * ```js
     * app.setDefaultRemovalPolicy(app.local ? "destroy" : "retain")
     * ```
     */
    setDefaultRemovalPolicy(policy: AppRemovalPolicy): void;
    /**
     * The default function props to be applied to all the Lambda functions in the app. These default values will be overridden if a Function sets its own props.
     * This needs to be called before a stack with any functions have been added to the app.
     *
     * @example
     * ```js
     * app.setDefaultFunctionProps({
     *   runtime: "nodejs12.x",
     *   timeout: 30
     * })
     * ```
     */
    setDefaultFunctionProps(props: FunctionProps | ((stack: cdk.Stack) => FunctionProps)): void;
    /**
     * Adds additional default Permissions to be applied to all Lambda functions in the app.
     *
     * @example
     * ```js
     * app.addDefaultFunctionPermissions(["s3"])
     * ```
     */
    addDefaultFunctionPermissions(permissions: Permissions): void;
    /**
     * Adds additional default environment variables to be applied to all Lambda functions in the app.
     *
     * @example
     * ```js
     * app.addDefaultFunctionPermissions({
     *   "MY_ENV_VAR": "my-value"
     * })
     * ```
     */
    addDefaultFunctionEnv(environment: Record<string, string>): void;
    /**
     * Adds additional default layers to be applied to all Lambda functions in the stack.
     */
    addDefaultFunctionLayers(layers: ILayerVersion[]): void;
    synth(options?: cdk.StageSynthesisOptions): cxapi.CloudAssembly;
    isRunningSSTTest(): boolean;
    registerLambdaHandler(handler: FunctionHandlerProps): void;
    registerSiteEnvironment(environment: BaseSiteEnvironmentOutputsInfo): void;
    getInputFilesFromEsbuildMetafile(file: string): Array<string>;
    private buildConstructsMetadata;
    private buildConstructsMetadata_collectConstructs;
    private applyRemovalPolicy;
    private createTypesFile;
    stack<T extends FunctionalStack<any>>(fn: T, props?: StackProps & {
        id?: string;
    }): ReturnType<T> extends Promise<any> ? Promise<void> : App;
}
export {};
