/**
 * Resource Adapter Types for Declarative Infrastructure API
 *
 * This module defines the interfaces for the Adapter pattern,
 * enabling integration of external CDK constructs into the framework.
 *
 * @module declarative-api/adapter.types
 */
import type { ResourceMetadata, ResourceType, Stage } from './core.types';
import type { IResourceEntity } from './resource.types';
/**
 * Adapter type identifiers for different construct categories.
 *
 * Used to categorize adapters by the type of construct they handle.
 */
export type AdapterType = 'dynamodb' | 'sqs' | 'sns' | 's3' | 'cognito' | 'events' | 'lambda' | 'apigateway' | 'custom';
/**
 * All valid adapter types as a readonly array.
 */
export declare const ADAPTER_TYPES: readonly AdapterType[];
/**
 * Type guard to check if a value is a valid AdapterType.
 *
 * @param value - The value to check
 * @returns True if the value is a valid AdapterType
 */
export declare function isValidAdapterType(value: unknown): value is AdapterType;
/**
 * Options for adapting external constructs.
 *
 * Controls how the adapter integrates the construct with the framework.
 *
 * Validates: Requirements 13.1
 */
export interface AdapterOptions {
    /** Enable automatic IAM permission granting */
    readonly enableAutoGrant?: boolean;
    /** Enable automatic environment variable injection */
    readonly enableAutoInject?: boolean;
    /** Custom metadata to apply to the adapted entity */
    readonly metadata?: Partial<ResourceMetadata>;
    /** Custom tags to apply */
    readonly tags?: Readonly<Record<string, string>>;
    /** Override the resource type detection */
    readonly resourceType?: ResourceType;
    /** Custom ID for the adapted entity (defaults to construct node id) */
    readonly id?: string;
}
/**
 * Result of an adaptation operation.
 *
 * Contains the adapted entity and metadata about the adaptation.
 */
export interface AdaptationResult<TEntity extends IResourceEntity> {
    /** The adapted resource entity */
    readonly entity: TEntity;
    /** Whether auto-grant was enabled */
    readonly autoGrantEnabled: boolean;
    /** Whether auto-inject was enabled */
    readonly autoInjectEnabled: boolean;
    /** The original construct type name */
    readonly originalConstructType: string;
    /** Timestamp of adaptation */
    readonly adaptedAt: Date;
}
/**
 * Resource Adapter interface for integrating external CDK constructs.
 *
 * Adapters transform external CDK constructs into framework-compatible
 * resource entities while preserving access to the original construct.
 *
 * Implements: Adapter Pattern
 *
 * @typeParam TOriginal - The original CDK construct type
 * @typeParam TEntity - The adapted resource entity type
 *
 * @example
 * ```typescript
 * // Adapt an external DynamoDB table
 * const adapter = new TableAdapter(serviceName, stage);
 * const entity = adapter.adapt('users-table', externalTable, {
 *   enableAutoGrant: true,
 *   enableAutoInject: true,
 * });
 *
 * // Access the original construct
 * const original = adapter.getOriginal(entity);
 * ```
 *
 * Validates: Requirements 13.1, 13.2, 13.3, 13.4, 13.5
 */
export interface IResourceAdapter<TOriginal = unknown, TEntity extends IResourceEntity = IResourceEntity> {
    /** The adapter type identifier */
    readonly adapterType: AdapterType;
    /** The resource type this adapter produces */
    readonly resourceType: ResourceType;
    /**
     * Adapt an external construct to a framework entity.
     *
     * @param id - Unique identifier for the adapted entity
     * @param original - The original CDK construct
     * @param options - Adaptation options
     * @returns The adapted resource entity
     */
    adapt(id: string, original: TOriginal, options?: AdapterOptions): TEntity;
    /**
     * Get the original construct from an adapted entity.
     *
     * @param entity - The adapted entity
     * @returns The original CDK construct
     */
    getOriginal(entity: TEntity): TOriginal;
    /**
     * Check if a construct can be adapted by this adapter.
     *
     * @param construct - The construct to check
     * @returns True if the construct can be adapted
     */
    canAdapt(construct: unknown): construct is TOriginal;
    /**
     * Check if an entity was adapted by this adapter.
     *
     * @param entity - The entity to check
     * @returns True if the entity was adapted by this adapter
     */
    isAdapted(entity: IResourceEntity): entity is TEntity;
}
/**
 * Registry for managing resource adapters.
 *
 * Provides a centralized location for registering and retrieving
 * adapters for different construct types.
 *
 * @example
 * ```typescript
 * const registry = new ResourceAdapterRegistry();
 *
 * // Register adapters
 * registry.register(new TableAdapter(serviceName, stage));
 * registry.register(new QueueAdapter(serviceName, stage));
 *
 * // Adapt a construct
 * const entity = registry.adapt('my-table', someConstruct);
 * ```
 *
 * Validates: Requirements 13.2
 */
export interface IResourceAdapterRegistry {
    /**
     * Register an adapter.
     *
     * @param adapter - The adapter to register
     * @throws DuplicateAdapterError if an adapter for the same type is already registered
     */
    register<TOriginal, TEntity extends IResourceEntity>(adapter: IResourceAdapter<TOriginal, TEntity>): void;
    /**
     * Unregister an adapter.
     *
     * @param adapterType - The adapter type to unregister
     * @returns True if an adapter was unregistered
     */
    unregister(adapterType: AdapterType): boolean;
    /**
     * Get an adapter by type.
     *
     * @param adapterType - The adapter type
     * @returns The adapter or undefined if not found
     */
    getAdapter<TOriginal = unknown, TEntity extends IResourceEntity = IResourceEntity>(adapterType: AdapterType): IResourceAdapter<TOriginal, TEntity> | undefined;
    /**
     * Get an adapter that can handle a construct.
     *
     * @param construct - The construct to find an adapter for
     * @returns The adapter or undefined if none can handle the construct
     */
    getAdapterForConstruct<TOriginal = unknown, TEntity extends IResourceEntity = IResourceEntity>(construct: unknown): IResourceAdapter<TOriginal, TEntity> | undefined;
    /**
     * Adapt a construct using the appropriate adapter.
     *
     * @param id - Unique identifier for the adapted entity
     * @param construct - The construct to adapt
     * @param options - Adaptation options
     * @returns The adapted entity
     * @throws AdapterNotFoundError if no adapter can handle the construct
     */
    adapt<TEntity extends IResourceEntity = IResourceEntity>(id: string, construct: unknown, options?: AdapterOptions): TEntity;
    /**
     * Check if an adapter is registered for a type.
     *
     * @param adapterType - The adapter type to check
     * @returns True if an adapter is registered
     */
    hasAdapter(adapterType: AdapterType): boolean;
    /**
     * Get all registered adapter types.
     *
     * @returns Array of registered adapter types
     */
    getRegisteredTypes(): readonly AdapterType[];
    /**
     * Get the count of registered adapters.
     */
    readonly count: number;
}
/**
 * Factory for creating resource adapters.
 *
 * Provides a convenient way to create adapters with common configuration.
 */
export interface IResourceAdapterFactory {
    /**
     * Create an adapter for a specific type.
     *
     * @param adapterType - The type of adapter to create
     * @param serviceName - The service name for metadata
     * @param stage - The deployment stage
     * @returns The created adapter
     */
    createAdapter<TOriginal = unknown, TEntity extends IResourceEntity = IResourceEntity>(adapterType: AdapterType, serviceName: string, stage: Stage): IResourceAdapter<TOriginal, TEntity>;
    /**
     * Create a registry with default adapters.
     *
     * @param serviceName - The service name for metadata
     * @param stage - The deployment stage
     * @returns A registry with default adapters registered
     */
    createDefaultRegistry(serviceName: string, stage: Stage): IResourceAdapterRegistry;
}
