import type { MicroserviceDefinition } from '../types/microservice.types';
/**
 * AWS configuration for Live Dev.
 *
 * @see Requirements 12.2
 */
export interface RuntimeAwakeAwsConfig {
    /** AWS region for IoT Core and other services */
    readonly region: string;
    /** AWS profile name (optional, uses default chain if not specified) */
    readonly profile?: string;
}
/**
 * Application identity configuration.
 *
 * @see Requirements 12.2
 */
export interface RuntimeAwakeAppConfig {
    /** Application name (used for resource naming) */
    readonly name: string;
    /** Deployment stage (dev, staging, prod) */
    readonly stage: string;
}
/**
 * Session management configuration.
 *
 * Controls heartbeat intervals and session timeout behavior.
 *
 * @see Requirements 6.2, 6.5
 */
export interface RuntimeAwakeSessionConfig {
    /** Heartbeat interval in milliseconds (default: 30000) */
    readonly heartbeatIntervalMs?: number;
    /** Session timeout in milliseconds (default: 60000) */
    readonly timeoutMs?: number;
}
/**
 * File watching configuration for hot reload.
 *
 * @see Requirements 5.1, 7.3
 */
export interface RuntimeAwakeWatchConfig {
    /** Directories to watch for changes */
    readonly paths: string[];
    /** Glob patterns to ignore */
    readonly ignore?: string[];
    /** Debounce delay in milliseconds (default: 100) */
    readonly debounceMs?: number;
}
/**
 * VPC Agent configuration for private resource access.
 *
 * Enables access to VPC resources (RDS, Redis, etc.) from
 * the developer's local machine without direct VPN access.
 *
 * @see Requirements 10.1, 10.4
 */
export interface VpcAgentConfig {
    /** Enable VPC Agent integration */
    readonly enabled: boolean;
    /** VPC Agent endpoint URL */
    readonly url?: string;
    /** Hosts to proxy through VPC Agent */
    readonly proxyHosts?: string[];
    /** Allowed ports for proxying */
    readonly allowedPorts?: number[];
}
/**
 * Debug and logging configuration.
 *
 * @see Requirements 14.2, 14.3, 14.4
 */
export interface RuntimeAwakeDebugConfig {
    /** Node.js inspector port for debugger attachment (default: 9229) */
    readonly inspectorPort?: number;
    /** Log level: 'debug' | 'info' | 'warn' | 'error' */
    readonly logLevel?: 'debug' | 'info' | 'warn' | 'error';
    /** Mask sensitive data in logs (default: true) */
    readonly maskSecrets?: boolean;
    /** Enable full payload logging (default: false) */
    readonly fullPayloadLogging?: boolean;
}
/**
 * Fallback behavior when no active session exists.
 *
 * - 'execute': Run the original handler in the cloud
 * - 'error': Return 503 "Live dev session not connected"
 *
 * @see Requirements 1.3, 1.4
 */
export type RuntimeAwakeFallbackMode = 'execute' | 'error';
/**
 * Live Development settings configuration.
 *
 * Core configuration for the Live Dev feature including
 * developer identification, fallback behavior, and microservice mappings.
 *
 * @see Requirements 12.1, 12.3, 12.4
 *
 * @example
 * ```typescript
 * const runtimeAwakeSettings: RuntimeAwakeSettings = {
 *   enabled: true,
 *   devId: 'john.doe',
 *   fallbackMode: 'execute',
 *   microservices: {
 *     payments: paymentsService,
 *     users: usersService,
 *   },
 *   session: {
 *     heartbeatIntervalMs: 30000,
 *     timeoutMs: 60000,
 *   },
 *   watch: {
 *     paths: ['./src'],
 *     ignore: ['node_modules', '*.test.ts'],
 *   },
 *   debug: {
 *     inspectorPort: 9229,
 *     logLevel: 'info',
 *   },
 * };
 * ```
 */
export interface RuntimeAwakeSettings<TMicroservices extends Record<string, MicroserviceDefinition> = Record<string, MicroserviceDefinition>> {
    /** Enable Live Dev mode */
    readonly enabled: boolean;
    /**
     * Developer ID for session isolation.
     *
     * Can be:
     * - Explicit string: 'john.doe'
     * - IAM variable: '${AWS_IAM_USER}' (resolved at runtime)
     *
     * @see Requirements 3.1
     */
    readonly devId: string;
    /**
     * Fallback behavior when local CLI is not connected.
     *
     * @see Requirements 1.3, 1.4
     */
    readonly fallbackMode: RuntimeAwakeFallbackMode;
    /**
     * Microservices enabled for Live Dev.
     *
     * Uses existing MicroserviceDefinition from the framework.
     * The Local CLI creates MicroserviceBundle instances from these
     * definitions to resolve handlers.
     *
     * @see Requirements 12.6
     */
    readonly microservices: TMicroservices;
    /** Session management configuration */
    readonly session?: RuntimeAwakeSessionConfig;
    /** Hot reload file watching configuration */
    readonly watch?: RuntimeAwakeWatchConfig;
    /** VPC Agent configuration (optional) */
    readonly vpcAgent?: VpcAgentConfig;
    /** Debug and logging configuration */
    readonly debug?: RuntimeAwakeDebugConfig;
}
/**
 * Complete Live Dev configuration.
 *
 * Top-level configuration interface that combines AWS settings,
 * application identity, and Live Dev-specific settings.
 *
 * This configuration is used by:
 * - Local CLI (`runtime dev` command)
 * - Proxy Lambda (for routing decisions)
 * - CDK constructs (for infrastructure deployment)
 *
 * @see Requirements 12.1, 12.2, 12.3, 12.4
 *
 * @example
 * ```typescript
 * import { RuntimeAwakeConfig } from '@worktif/runtime';
 * import { paymentsService } from './src/microservices/payments';
 * import { usersService } from './src/microservices/users';
 *
 * export const config: RuntimeAwakeConfig = {
 *   aws: {
 *     region: 'us-east-1',
 *     profile: 'dev-profile',
 *   },
 *   app: {
 *     name: 'my-service',
 *     stage: 'dev',
 *   },
 *   awake: {
 *     enabled: true,
 *     devId: 'john.doe',
 *     fallbackMode: 'execute',
 *     microservices: {
 *       payments: paymentsService,
 *       users: usersService,
 *     },
 *     watch: {
 *       paths: ['./src'],
 *       ignore: ['node_modules', '*.test.ts'],
 *     },
 *     debug: {
 *       inspectorPort: 9229,
 *       logLevel: 'info',
 *     },
 *   },
 * };
 * ```
 */
export interface RuntimeAwakeConfig<TMicroservices extends Record<string, MicroserviceDefinition> = Record<string, MicroserviceDefinition>> {
    /** AWS configuration */
    readonly aws: RuntimeAwakeAwsConfig;
    /** Application identity */
    readonly app: RuntimeAwakeAppConfig;
    /** Live Development settings */
    readonly awake: RuntimeAwakeSettings<TMicroservices>;
}
/**
 * Runtime metadata generated by CDK for Local CLI consumption.
 *
 * Contains AWS resource identifiers needed by the Local CLI
 * to connect to the Live Dev infrastructure.
 *
 * @see Requirements 18.5
 */
export interface RuntimeAwakeMetadata {
    /** IoT Core endpoint URL */
    readonly iotEndpoint: string;
    /** DynamoDB session table name */
    readonly sessionTableName: string;
    /** S3 payload bucket name */
    readonly payloadBucketName: string;
    /** Mapping of Lambda construct IDs to handler hash keys */
    readonly handlers: Record<string, {
        /** Lambda function ARN */
        readonly arn: string;
        /** Microservice name */
        readonly microserviceName: string;
        /** Handler hash key */
        readonly handlerHashKey: string;
    }>;
}
