/**
 * Resource Factory Types for Declarative Infrastructure API
 *
 * This module defines the interfaces for the Abstract Factory pattern,
 * enabling creation of families of related AWS resources.
 *
 * @module declarative-api/factory.types
 */
import type { IResourceEntity } from './resource.types';
import type { IResourceComposite } from './composite.types';
import type { IResourceDecorator } from './decorator.types';
/**
 * Resource family type discriminator.
 *
 * Each family represents a group of related AWS resources:
 * - dynamodb: DynamoDB tables, GSIs, streams
 * - messaging: SQS queues, SNS topics
 * - auth: Cognito user pools, clients
 * - storage: S3 buckets
 * - events: EventBridge event buses, rules
 *
 * Validates: Requirements 2.1
 */
export type ResourceFamily = 'dynamodb' | 'messaging' | 'auth' | 'storage' | 'events';
/**
 * All resource family values as a readonly array.
 * Useful for validation and iteration.
 */
export declare const RESOURCE_FAMILIES: readonly ResourceFamily[];
/**
 * Type guard to check if a value is a valid ResourceFamily.
 *
 * @param value - The value to check
 * @returns True if the value is a valid ResourceFamily
 */
export declare function isValidResourceFamily(value: unknown): value is ResourceFamily;
/**
 * Options for factory resource creation.
 *
 * Controls automatic integration features and decorators.
 *
 * Validates: Requirements 2.4
 */
export interface FactoryOptions {
    /** Enable automatic IAM permission granting (default: true) */
    readonly autoGrant?: boolean;
    /** Enable automatic environment variable injection (default: true) */
    readonly autoInject?: boolean;
    /** Decorators to apply to created resources */
    readonly decorators?: readonly IResourceDecorator[];
    /** Custom tags to apply to resources */
    readonly tags?: Readonly<Record<string, string>>;
}
/**
 * Result of a factory creation operation.
 */
export interface FactoryCreationResult<T extends IResourceEntity = IResourceEntity> {
    /** Whether the creation was successful */
    readonly success: boolean;
    /** The created resource or composite */
    readonly resource?: T;
    /** Error message if creation failed */
    readonly error?: string;
    /** Timestamp of creation */
    readonly timestamp: Date;
}
/**
 * Abstract Factory interface for creating families of related resources.
 *
 * Each factory creates resources with proper relationships and defaults.
 * Factories accept full CDK Props without restrictions through generic types.
 *
 * Implements: Abstract Factory Pattern
 *
 * @typeParam TFamily - The resource family type this factory creates
 *
 * @example
 * ```typescript
 * // Using a DynamoDB factory
 * const factory: IResourceFactory<'dynamodb'> = new DynamoDbResourceFactory(context);
 * const composite = factory.create('users-table', tableProps);
 *
 * // Get a builder for custom construction
 * const builder = factory.getBuilder<TableProps>('orders-table');
 * const table = builder.withProps(props).withAutoGrant().build();
 * ```
 *
 * Validates: Requirements 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
 */
export interface IResourceFactory<TFamily extends ResourceFamily = ResourceFamily> {
    /**
     * Factory family type identifier.
     */
    readonly familyType: TFamily;
    /**
     * Create a resource with full CDK props.
     *
     * Returns a composite containing the created resource and any
     * related resources (e.g., GSIs for tables, DLQs for queues).
     *
     * @typeParam TProps - The CDK props type for the resource
     * @param id - Unique identifier for the resource
     * @param props - Full CDK props (no restrictions)
     * @param options - Optional factory options
     * @returns A composite containing created resources
     */
    create<TProps>(id: string, props: TProps, options?: FactoryOptions): IResourceComposite;
    /**
     * Get a builder for custom resource construction.
     *
     * Use this when you need more control over the creation process
     * than the simple create() method provides.
     *
     * @typeParam TProps - The CDK props type for the resource
     * @param id - Unique identifier for the resource
     * @returns A builder for the resource
     */
    getBuilder<TProps>(id: string): IResourceBuilder<IResourceEntity, TProps>;
    /**
     * Check if this factory can create a resource of the given type.
     *
     * @param resourceType - The resource type to check
     * @returns True if this factory can create the resource type
     */
    canCreate(resourceType: string): boolean;
    /**
     * Get the supported resource types for this factory.
     *
     * @returns Array of supported resource type strings
     */
    getSupportedTypes(): readonly string[];
}
/**
 * Resource Builder interface for fluent resource construction.
 *
 * Provides a fluent interface for step-by-step resource construction
 * with validation at each step.
 *
 * @typeParam TEntity - The resource entity type being built
 * @typeParam TProps - The CDK props type
 *
 * Validates: Requirements 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7
 */
export interface IResourceBuilder<TEntity extends IResourceEntity, TProps = unknown> {
    /**
     * Set full CDK props (no restrictions).
     *
     * @param props - The CDK props to set
     * @returns This builder for method chaining
     */
    withProps(props: TProps): this;
    /**
     * Merge additional props (deep merge).
     *
     * @param overrides - Partial props to merge
     * @returns This builder for method chaining
     */
    withPropsOverride(overrides: Partial<TProps>): this;
    /**
     * Enable automatic IAM permission granting.
     *
     * @param enabled - Whether to enable auto-grant (default: true)
     * @returns This builder for method chaining
     */
    withAutoGrant(enabled?: boolean): this;
    /**
     * Enable automatic environment variable injection.
     *
     * @param config - Injection configuration
     * @returns This builder for method chaining
     */
    withAutoInject(config?: InjectionConfig): this;
    /**
     * Add a decorator for cross-cutting concerns.
     *
     * @param decorator - The decorator to add
     * @returns This builder for method chaining
     */
    withDecorator(decorator: IResourceDecorator): this;
    /**
     * Add to a composite group.
     *
     * @param composite - The composite to add to
     * @returns This builder for method chaining
     */
    withGroup(composite: IResourceComposite): this;
    /**
     * Add custom tags to the resource.
     *
     * @param tags - Tags to add
     * @returns This builder for method chaining
     */
    withTags(tags: Record<string, string>): this;
    /**
     * Validate the current configuration.
     *
     * @returns Validation result with any errors
     */
    validate(): BuilderValidationResult;
    /**
     * Build the resource.
     *
     * @returns The built resource entity
     * @throws Error if validation fails
     */
    build(): TEntity;
}
/**
 * Configuration for environment variable injection.
 */
export interface InjectionConfig {
    /** Environment variable name prefix */
    readonly envVarName?: string;
    /** Custom value extractor function */
    readonly valueExtractor?: (construct: unknown) => string;
    /** Include ARN in environment variables */
    readonly includeArn?: boolean;
    /** Include name in environment variables */
    readonly includeName?: boolean;
    /** Include URL in environment variables (for queues, etc.) */
    readonly includeUrl?: boolean;
}
/**
 * Result of builder validation.
 */
export interface BuilderValidationResult {
    /** Whether the configuration is valid */
    readonly isValid: boolean;
    /** Validation errors if any */
    readonly errors: readonly BuilderValidationError[];
}
/**
 * A validation error from the builder.
 */
export interface BuilderValidationError {
    /** Path to the invalid property */
    readonly path: string;
    /** Error message */
    readonly message: string;
    /** Error code for programmatic handling */
    readonly code: string;
}
/**
 * Factory registry interface for managing multiple factories.
 *
 * Provides a central registry for all resource factories.
 */
export interface IResourceFactoryRegistry {
    /**
     * Register a factory.
     *
     * @param factory - The factory to register
     */
    register<TFamily extends ResourceFamily>(factory: IResourceFactory<TFamily>): void;
    /**
     * Get a factory by family type.
     *
     * @param familyType - The family type to get
     * @returns The factory or undefined if not found
     */
    get<TFamily extends ResourceFamily>(familyType: TFamily): IResourceFactory<TFamily> | undefined;
    /**
     * Check if a factory is registered.
     *
     * @param familyType - The family type to check
     * @returns True if a factory is registered
     */
    has(familyType: ResourceFamily): boolean;
    /**
     * Get all registered factories.
     *
     * @returns Array of all registered factories
     */
    getAll(): readonly IResourceFactory[];
    /**
     * Get all registered family types.
     *
     * @returns Array of registered family types
     */
    getFamilyTypes(): readonly ResourceFamily[];
}
/**
 * DynamoDB stream view type with strict typing.
 *
 * Mirrors CDK StreamViewType enum for type safety without requiring CDK import.
 * - 'KEYS_ONLY': Only the key attributes of the modified item
 * - 'NEW_IMAGE': The entire item, as it appears after modification
 * - 'OLD_IMAGE': The entire item, as it appeared before modification
 * - 'NEW_AND_OLD_IMAGES': Both the new and old images of the item
 *
 * Validates: Requirements 5.2
 */
export type StreamViewType = 'KEYS_ONLY' | 'NEW_IMAGE' | 'OLD_IMAGE' | 'NEW_AND_OLD_IMAGES';
/**
 * Permission grant type with strict typing.
 *
 * Replaces string type for compile-time validation and IDE autocomplete.
 * - 'read': Read-only access (e.g., GetItem, Query, Scan for DynamoDB)
 * - 'write': Write-only access (e.g., PutItem, DeleteItem for DynamoDB)
 * - 'readWrite': Full read and write access
 *
 * Validates: Requirements 5.1
 */
export type GrantType = 'read' | 'write' | 'readWrite';
/**
 * DynamoDB-specific factory options.
 *
 * Extends base factory options with DynamoDB-specific settings.
 * Aligns with TableCreationOptions from IFrameworkResourceProvider.
 *
 * Validates: Requirements 7.3
 */
export interface DynamoDbFactoryOptions extends FactoryOptions {
    /**
     * Enable DynamoDB Streams.
     * @default false
     */
    readonly enableStream?: boolean;
    /**
     * Stream view type when streams are enabled.
     * @default 'NEW_AND_OLD_IMAGES'
     */
    readonly streamViewType?: StreamViewType;
    /**
     * Enable Point-in-Time Recovery.
     * When set, overrides the stage-based default (true for prod, false otherwise).
     */
    readonly enablePitr?: boolean;
    /**
     * Enable Time-to-Live on the table.
     * Requires ttlAttributeName to be set.
     * @default false
     */
    readonly enableTtl?: boolean;
    /**
     * TTL attribute name (used when enableTtl is true).
     * The attribute must be of type Number and contain Unix epoch timestamps.
     */
    readonly ttlAttributeName?: string;
    /**
     * Permission level for auto-grant.
     * Uses strict union type for compile-time validation.
     * @default 'readWrite'
     */
    readonly grantType?: GrantType;
    /**
     * Override framework name generation.
     * When true, uses tableName from props instead of generating framework-compliant name.
     * @default false
     */
    readonly overrideName?: boolean;
    /**
     * Override framework removal policy.
     * When true, uses removalPolicy from props instead of stage-based default.
     * @default false
     */
    readonly overrideRemovalPolicy?: boolean;
    /**
     * Override framework PITR configuration.
     * When true, uses pointInTimeRecovery from props instead of stage-based default.
     * @default false
     */
    readonly overridePitr?: boolean;
    /**
     * Override framework encryption configuration.
     * When true, uses encryption from props instead of framework default.
     * @default false
     */
    readonly overrideEncryption?: boolean;
}
/**
 * DynamoDB Resource Factory interface.
 *
 * Specialized factory for creating DynamoDB tables and related resources.
 */
export interface IDynamoDbResourceFactory extends IResourceFactory<'dynamodb'> {
    /**
     * Create a DynamoDB table.
     *
     * @typeParam TProps - Table props type
     * @param id - Unique identifier
     * @param props - Table props
     * @param options - DynamoDB-specific options
     * @returns The created table entity
     */
    createTable<TProps>(id: string, props: TProps, options?: DynamoDbFactoryOptions): IResourceEntity;
    /**
     * Create a table with Global Secondary Indexes.
     *
     * @typeParam TProps - Table props type
     * @typeParam TGsiProps - GSI props type
     * @param id - Unique identifier
     * @param props - Table props
     * @param gsiProps - Array of GSI props
     * @param options - DynamoDB-specific options
     * @returns A composite containing table and GSIs
     */
    createTableWithGsi<TProps, TGsiProps>(id: string, props: TProps, gsiProps: readonly TGsiProps[], options?: DynamoDbFactoryOptions): IResourceComposite;
}
/**
 * Messaging-specific factory options.
 *
 * Extends base factory options with messaging-specific settings.
 * Aligns with QueueCreationOptions and TopicCreationOptions from IFrameworkResourceProvider.
 *
 * Validates: Requirements 7.3
 */
export interface MessagingFactoryOptions extends FactoryOptions {
    /**
     * Enable Dead Letter Queue for SQS.
     * @default false
     */
    readonly enableDlq?: boolean;
    /**
     * Maximum receive count before sending to DLQ.
     * Only used when enableDlq is true.
     * @default 3
     */
    readonly maxReceiveCount?: number;
    /**
     * Enable FIFO for SQS queues.
     * @default false
     */
    readonly fifo?: boolean;
    /**
     * Enable content-based deduplication for FIFO queues.
     * @default false
     */
    readonly contentBasedDeduplication?: boolean;
    /**
     * Permission level for auto-grant.
     * Uses strict union type for compile-time validation.
     * @default 'readWrite'
     */
    readonly grantType?: GrantType;
    /**
     * Override framework name generation.
     * When true, uses queueName/topicName from props instead of generating framework-compliant name.
     * @default false
     */
    readonly overrideName?: boolean;
    /**
     * Override framework removal policy.
     * When true, uses removalPolicy from props instead of stage-based default.
     * @default false
     */
    readonly overrideRemovalPolicy?: boolean;
}
/**
 * Messaging Resource Factory interface.
 *
 * Specialized factory for creating SQS queues and SNS topics.
 */
export interface IMessagingResourceFactory extends IResourceFactory<'messaging'> {
    /**
     * Create an SQS queue.
     *
     * @typeParam TProps - Queue props type
     * @param id - Unique identifier
     * @param props - Queue props
     * @param options - Messaging-specific options
     * @returns The created queue entity (or composite with DLQ)
     */
    createQueue<TProps>(id: string, props: TProps, options?: MessagingFactoryOptions): IResourceEntity | IResourceComposite;
    /**
     * Create an SNS topic.
     *
     * @typeParam TProps - Topic props type
     * @param id - Unique identifier
     * @param props - Topic props
     * @param options - Messaging-specific options
     * @returns The created topic entity
     */
    createTopic<TProps>(id: string, props: TProps, options?: MessagingFactoryOptions): IResourceEntity;
    /**
     * Create a queue subscribed to a topic.
     *
     * @typeParam TQueueProps - Queue props type
     * @typeParam TTopicProps - Topic props type
     * @param id - Unique identifier
     * @param queueProps - Queue props
     * @param topicProps - Topic props
     * @param options - Messaging-specific options
     * @returns A composite containing topic and queue
     */
    createTopicWithQueue<TQueueProps, TTopicProps>(id: string, queueProps: TQueueProps, topicProps: TTopicProps, options?: MessagingFactoryOptions): IResourceComposite;
}
/**
 * MFA configuration type with strict typing.
 *
 * - 'OFF': MFA is disabled
 * - 'OPTIONAL': Users can optionally enable MFA
 * - 'REQUIRED': MFA is required for all users
 *
 * Validates: Requirements 5.3
 */
export type MfaType = 'OFF' | 'OPTIONAL' | 'REQUIRED';
/**
 * Auth-specific factory options.
 *
 * Extends base factory options with Cognito-specific settings.
 * Aligns with UserPoolCreationOptions from IFrameworkResourceProvider.
 *
 * Validates: Requirements 7.3
 */
export interface AuthFactoryOptions extends FactoryOptions {
    /**
     * Create a user pool client.
     * @default true
     */
    readonly createClient?: boolean;
    /**
     * Client name (used when createClient is true).
     */
    readonly clientName?: string;
    /**
     * Enable self sign-up.
     * @default true
     */
    readonly selfSignUp?: boolean;
    /**
     * MFA configuration.
     * Uses strict union type for compile-time validation.
     * @default 'OFF'
     */
    readonly mfa?: MfaType;
    /**
     * Permission level for auto-grant.
     * Uses strict union type for compile-time validation.
     * @default 'readWrite'
     */
    readonly grantType?: GrantType;
    /**
     * Override framework name generation.
     * When true, uses userPoolName from props instead of generating framework-compliant name.
     * @default false
     */
    readonly overrideName?: boolean;
    /**
     * Override framework removal policy.
     * When true, uses removalPolicy from props instead of stage-based default.
     * @default false
     */
    readonly overrideRemovalPolicy?: boolean;
}
/**
 * Auth Resource Factory interface.
 *
 * Specialized factory for creating Cognito user pools and clients.
 */
export interface IAuthResourceFactory extends IResourceFactory<'auth'> {
    /**
     * Create a Cognito User Pool.
     *
     * @typeParam TProps - User pool props type
     * @param id - Unique identifier
     * @param props - User pool props
     * @param options - Auth-specific options
     * @returns The created user pool entity (or composite with client)
     */
    createUserPool<TProps>(id: string, props: TProps, options?: AuthFactoryOptions): IResourceEntity | IResourceComposite;
    /**
     * Create a User Pool Client.
     *
     * @typeParam TProps - Client props type
     * @param id - Unique identifier
     * @param userPoolId - The user pool to attach to
     * @param props - Client props
     * @param options - Auth-specific options
     * @returns The created client entity
     */
    createUserPoolClient<TProps>(id: string, userPoolId: string, props: TProps, options?: AuthFactoryOptions): IResourceEntity;
}
/**
 * S3 encryption type with strict typing.
 *
 * - 'S3_MANAGED': Server-side encryption with Amazon S3-managed keys (SSE-S3)
 * - 'KMS': Server-side encryption with customer-managed KMS key
 * - 'KMS_MANAGED': Server-side encryption with AWS-managed KMS key
 *
 * Validates: Requirements 5.4
 */
export type EncryptionType = 'S3_MANAGED' | 'KMS' | 'KMS_MANAGED';
/**
 * Storage-specific factory options.
 *
 * Extends base factory options with S3-specific settings.
 * Aligns with BucketCreationOptions from IFrameworkResourceProvider.
 *
 * Validates: Requirements 7.3
 */
export interface StorageFactoryOptions extends FactoryOptions {
    /**
     * Enable versioning.
     * Defaults based on stage (true for prod).
     */
    readonly versioned?: boolean;
    /**
     * Enable encryption.
     * @default true
     */
    readonly encrypted?: boolean;
    /**
     * Encryption type.
     * Uses strict union type for compile-time validation.
     * @default 'S3_MANAGED'
     */
    readonly encryptionType?: EncryptionType;
    /**
     * Enable public access.
     * @default false
     */
    readonly publicAccess?: boolean;
    /**
     * Enable website hosting.
     * @default false
     */
    readonly websiteHosting?: boolean;
    /**
     * Enable CORS.
     * @default false
     */
    readonly cors?: boolean;
    /**
     * Permission level for auto-grant.
     * Uses strict union type for compile-time validation.
     * @default 'readWrite'
     */
    readonly grantType?: GrantType;
    /**
     * Override framework name generation.
     * When true, uses bucketName from props instead of generating framework-compliant name.
     * @default false
     */
    readonly overrideName?: boolean;
    /**
     * Override framework removal policy.
     * When true, uses removalPolicy from props instead of stage-based default.
     * @default false
     */
    readonly overrideRemovalPolicy?: boolean;
    /**
     * Override framework versioning configuration.
     * When true, uses versioned from props instead of stage-based default.
     * @default false
     */
    readonly overrideVersioning?: boolean;
    /**
     * Override framework encryption configuration.
     * When true, uses encryption from props instead of framework default.
     * @default false
     */
    readonly overrideEncryption?: boolean;
}
/**
 * Storage Resource Factory interface.
 *
 * Specialized factory for creating S3 buckets.
 */
export interface IStorageResourceFactory extends IResourceFactory<'storage'> {
    /**
     * Create an S3 bucket.
     *
     * @typeParam TProps - Bucket props type
     * @param id - Unique identifier
     * @param props - Bucket props
     * @param options - Storage-specific options
     * @returns The created bucket entity
     */
    createBucket<TProps>(id: string, props: TProps, options?: StorageFactoryOptions): IResourceEntity;
    /**
     * Create a website bucket.
     *
     * @typeParam TProps - Bucket props type
     * @param id - Unique identifier
     * @param props - Bucket props
     * @param options - Storage-specific options
     * @returns The created bucket entity configured for website hosting
     */
    createWebsiteBucket<TProps>(id: string, props: TProps, options?: StorageFactoryOptions): IResourceEntity;
}
/**
 * Events-specific factory options.
 *
 * Extends base factory options with EventBridge-specific settings.
 * Aligns with EventBusCreationOptions from IFrameworkResourceProvider.
 *
 * Validates: Requirements 7.3
 */
export interface EventsFactoryOptions extends FactoryOptions {
    /**
     * Enable event archiving.
     * @default false
     */
    readonly archiveEvents?: boolean;
    /**
     * Archive retention days (used when archiveEvents is true).
     * @default 30
     */
    readonly archiveRetentionDays?: number;
    /**
     * Permission level for auto-grant.
     * Uses strict union type for compile-time validation.
     * @default 'readWrite'
     */
    readonly grantType?: GrantType;
    /**
     * Override framework name generation.
     * When true, uses eventBusName from props instead of generating framework-compliant name.
     * @default false
     */
    readonly overrideName?: boolean;
}
/**
 * Events Resource Factory interface.
 *
 * Specialized factory for creating EventBridge event buses and rules.
 */
export interface IEventsResourceFactory extends IResourceFactory<'events'> {
    /**
     * Create an EventBridge Event Bus.
     *
     * @typeParam TProps - Event bus props type
     * @param id - Unique identifier
     * @param props - Event bus props
     * @param options - Events-specific options
     * @returns The created event bus entity
     */
    createEventBus<TProps>(id: string, props: TProps, options?: EventsFactoryOptions): IResourceEntity;
    /**
     * Create an Event Bus with rules.
     *
     * @typeParam TBusProps - Event bus props type
     * @typeParam TRuleProps - Rule props type
     * @param id - Unique identifier
     * @param busProps - Event bus props
     * @param ruleProps - Array of rule props
     * @param options - Events-specific options
     * @returns A composite containing event bus and rules
     */
    createEventBusWithRules<TBusProps, TRuleProps>(id: string, busProps: TBusProps, ruleProps: readonly TRuleProps[], options?: EventsFactoryOptions): IResourceComposite;
}
