import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
import * as events from 'aws-cdk-lib/aws-events';
import { RuntimeInfraStack } from './runtime-infra-stack';
import { RuntimeInfraResourceOptions, RuntimeInfraResources } from './interfaces';
/**
 * Properties for the RuntimeStack
 */
export interface RuntimeStackProps extends cdk.StackProps {
    /**
     * Deployment stage (dev, staging, prod)
     */
    stage: 'dev' | 'staging' | 'prod';
    /**
     * Service name for resource naming
     */
    serviceName: string;
    /**
     * Enable SEO features with DynamoDB
     * @default false
     */
    enableSeo?: boolean;
    /**
     * Enable API Gateway integration
     * @default false
     */
    enableApiGateway?: boolean;
    /**
     * API Gateway type (RestApi or HttpApi)
     * @default 'HttpApi'
     */
    apiGatewayType?: 'RestApi' | 'HttpApi';
    /**
     * Enable Lambda warmup with CloudWatch Events
     * @default true for prod/staging, false for dev
     */
    enableWarmup?: boolean;
    /**
     * Allowed origins for CORS configuration
     * @default ['*'] for all stages
     */
    allowedOrigins?: string[];
    /**
     * Path to user's application entry point
     * @example './src/index.tsx'
     */
    appEntryPoint?: string;
    /**
     * Path to Lambda bundle directory (deprecated - use appEntryPoint instead)
     * @deprecated Use appEntryPoint instead for automatic bundling
     * @default Auto-resolved
     */
    lambdaBundlePath?: string;
    /**
     * Custom environment variables for Lambda function
     * @default {}
     */
    customEnvironmentVariables?: Record<string, string>;
    /**
     * Lambda function memory size in MB
     * @default 512
     */
    lambdaMemorySize?: number;
    /**
     * Lambda function timeout in seconds
     * @default 29
     */
    lambdaTimeout?: number;
    /**
     * Reference to Infra stack for cross-stack references
     */
    infraStack: RuntimeInfraStack;
}
/**
 * RuntimeStack - Runtime resources for Runtime serverless rendering cross-domain application
 *
 * This construct creates fast-changing runtime resources:
 * - Lambda functions for serverless rendering, SEO, manifest, and warmup handlers
 * - Lambda Layers with React/Router dependencies
 * - API Gateway for HTTP routing (optional)
 * - CloudWatch Events for Lambda warmup (optional)
 *
 * These resources are deployed separately from infrastructure resources (S3, DynamoDB, CloudFront)
 * to enable faster deployments when only application code changes.
 *
 * The stack imports CloudFormation outputs from RuntimeInfraStack via cross-stack references
 * to configure Lambda environment variables with infrastructure resource names.
 *
 * @example Basic usage
 * ```typescript
 * import { RuntimeInfraStack, RuntimeStack } from '@worktif/runtime/infra';
 *
 * const infraStack = new RuntimeInfraStack(app, 'serviceName-RuntimeInfra-dev', {
 *   stage: 'dev',
 *   serviceName: 'my-app',
 *   enableSeo: true,
 * });
 *
 * const runtimeStack = new RuntimeStack(app, 'serviceName-Runtime-dev', {
 *   stage: 'dev',
 *   serviceName: 'my-app',
 *   appEntryPoint: './src/index.tsx',
 *   infraStack,
 * });
 * ```
 */
export declare class RuntimeStack extends cdk.Stack implements RuntimeInfraResources {
    /**
     * Lambda function for serverless rendering handler
     */
    readonly runtimeLambda: lambda.Function;
    /**
     * Lambda function for SEO metadata handler (optional)
     */
    readonly seoLambda?: lambda.Function;
    /**
     * Lambda function for SEO by route handler (optional)
     */
    readonly seoByRouteLambda?: lambda.Function;
    /**
     * Lambda function for manifest generation handler (optional)
     */
    readonly manifestLambda?: lambda.Function;
    /**
     * Lambda function for warmup handler (optional)
     */
    readonly warmupLambda?: lambda.Function;
    /**
     * API Gateway HttpApi for routing requests to Lambda handlers (optional)
     */
    readonly apiGateway?: apigatewayv2.HttpApi;
    /**
     * API Gateway stage (optional)
     */
    readonly apiGatewayStage?: apigatewayv2.HttpStage;
    /**
     * CloudFront distribution for content delivery
     */
    readonly distribution: cloudfront.Distribution;
    /**
     * CloudWatch Events rule for Lambda warmup (optional)
     */
    readonly warmupRule?: events.Rule;
    constructor(scope: Construct, id: string, props: RuntimeStackProps);
    /**
     * Creates CloudFront distribution with Lambda and S3 origins
     *
     * Override this method to customize CloudFront configuration such as:
     * - Custom domain and certificate
     * - Additional cache behaviors
     * - Custom error responses
     * - WAF integration
     * - Lambda@Edge functions
     *
     * @param props - Stack properties
     * @returns CloudFront Distribution instance
     *
     * @protected
     * @example
     * ```typescript
     * class CustomStack extends RuntimeStack {
     *   protected createCloudFrontDistribution(props: RuntimeStackProps): cloudfront.Distribution {
     *     const dist = super.createCloudFrontDistribution(props);
     *     // Add custom error response
     *     dist.addBehavior('/api/*', myApiOrigin);
     *     return dist;
     *   }
     * }
     * ```
     */
    protected createCloudFrontDistribution(props: RuntimeStackProps): cloudfront.Distribution;
    /**
     * Creates Lambda functions for all handlers
     *
     * @param props - Stack properties
     * @param handlerPath - Path to Lambda handler bundle
     * @param layerPath - Path to Lambda Layer directory
     * @param lambdaEnvironment - Environment variables for Lambda functions
     * @param lambdaRole - IAM role for Lambda execution
     * @returns Object with handler Lambda functions
     * @protected
     */
    protected createLambdaFunctions(props: RuntimeStackProps, handlerPath: string, layerPath: string, lambdaEnvironment: Record<string, string>, lambdaRole: iam.IRole): {
        handler: lambda.Function;
        seo?: lambda.Function;
        seoByRoute?: lambda.Function;
        warmup?: lambda.Function;
    };
    /**
     * Creates a Lambda handler with shared configuration
     *
     * @param config - Handler configuration
     * @param handlerPath - Path to Lambda handler bundle
     * @param runtimeLayer - Lambda Layer with React/Router dependencies
     * @param lambdaEnvironment - Environment variables for the function
     * @param lambdaRole - IAM role for Lambda execution
     * @returns Lambda Function instance
     * @protected
     */
    protected createLambdaHandler(config: {
        id: string;
        functionName: string;
        handler: string;
        timeout: number;
        memorySize: number;
        description: string;
    }, handlerPath: string, runtimeLayer: lambda.LayerVersion, lambdaEnvironment: Record<string, string>, lambdaRole: iam.IRole): lambda.Function;
    /**
     * Creates API Gateway HttpApi with CORS configuration and Lambda integrations
     *
     * @param props - Stack properties
     * @param lambdas - Lambda functions for integrations
     * @returns HttpApi instance
     * @protected
     */
    protected createApiGateway(props: RuntimeStackProps, lambdas: {
        handler: lambda.Function;
        seo: lambda.Function;
        seoByRoute: lambda.Function;
        manifest?: lambda.Function;
    }): apigatewayv2.HttpApi;
    /**
     * Creates CloudWatch Events rule for Lambda warmup
     *
     * @param props - Stack properties
     * @param warmupLambda - Lambda function to invoke for warmup
     * @returns CloudWatch Events Rule instance or undefined if warmup is disabled
     * @protected
     */
    protected createWarmupRule(props: RuntimeStackProps, warmupLambda: lambda.Function): events.Rule | undefined;
    /**
     * Creates CloudFormation outputs for stack resources
     *
     * @param props - Stack properties
     * @protected
     */
    protected createOutputs(props: RuntimeStackProps): void;
    /**
     * Prepares Lambda bundle by bundling user's application code with Runtime handler
     *
     * @param props - Stack properties containing appEntryPoint
     * @returns Object with paths to bundled Lambda handler and layer directories
     * @throws Error if bundling fails or appEntryPoint is invalid
     * @protected
     */
    protected prepareLambdaBundle(props: RuntimeStackProps): {
        handlerPath: string;
        layerPath: string;
    };
    /**
     * Generates a signature for the provided region by extracting the first character of each segment in the region string, delimited by hyphens.
     *
     * @param {string} region - The region string to generate the signature from. It is expected to be a hyphen-separated string.
     * @return {string} The generated region signature, formed by concatenating the first character of each valid segment. Returns an empty string if the input is invalid or empty.
     */
    private getRegionSignature;
    /**
     * Generates a resource name by concatenating service name, resource name,
     * simplified region, and stage with hyphens as separators.
     *
     * @param {Object} params - An object containing the required parameters.
     * @param {string} params.name - The name of the resource.
     * @param {string} params.serviceName - The name of the service associated with the resource.
     * @param {string} params.regionSimplified - The simplified region identifier.
     * @param {string} params.stage - The deployment stage of the resource.
     * @returns {string} The concatenated resource name.
     */
    resourceName({ name, serviceName, stage, region }: RuntimeInfraResourceOptions): string;
}
