/**
 * Resource Repository Implementation
 *
 * This module provides the implementation of the Repository pattern
 * with Identity Map caching for resource management.
 *
 * @module declarative-api/repository/resource-repository
 */
import type { ResourceType, IResourceEntity, ISpecification } from '../../../lib/runtime-web/types/declarative-api';
import type { IResourceRepository, ITypedResourceRepository, IResourceRepositoryFactory } from '../../../lib/runtime-web/types/declarative-api';
/**
 * Resource Repository implementation with Identity Map pattern.
 *
 * The Identity Map ensures that:
 * - Each resource is only stored once (by ID)
 * - Multiple requests for the same resource return the same instance
 * - No duplicate resources can be registered
 *
 * @example
 * ```typescript
 * const repository = new ResourceRepository();
 *
 * // Register a resource
 * repository.register(tableEntity);
 *
 * // Get by ID (returns same instance)
 * const table1 = repository.getById('users-table');
 * const table2 = repository.getById('users-table');
 * console.log(table1 === table2); // true (Identity Map)
 *
 * // Query with specification
 * const prodResources = repository.query(new StageSpec('prod'));
 * ```
 *
 * Validates: Requirements 10.1, 10.2, 10.3, 10.4, 10.5
 */
export declare class ResourceRepository implements IResourceRepository {
    /**
     * Identity Map: stores resources by their unique ID.
     * This ensures each resource is only stored once and
     * multiple requests return the same instance.
     */
    private readonly identityMap;
    /**
     * Type index: stores resource IDs grouped by type for efficient type queries.
     * This avoids iterating through all resources when filtering by type.
     */
    private readonly typeIndex;
    /**
     * Get a resource by its unique identifier.
     *
     * @typeParam T - The expected resource entity type
     * @param id - The unique resource identifier
     * @returns The resource entity
     * @throws ResourceNotFoundException if resource does not exist
     */
    getById<T extends IResourceEntity>(id: string): T;
    /**
     * Get a resource by its unique identifier, or null if not found.
     *
     * @typeParam T - The expected resource entity type
     * @param id - The unique resource identifier
     * @returns The resource entity or null
     */
    getByIdOrNull<T extends IResourceEntity>(id: string): T | null;
    /**
     * Get all resources of a specific type.
     *
     * Uses the type index for efficient lookup.
     *
     * @typeParam T - The expected resource entity type
     * @param type - The resource type to filter by
     * @returns Array of matching resource entities
     */
    getByType<T extends IResourceEntity>(type: ResourceType): T[];
    /**
     * Get all registered resources.
     *
     * @returns Array of all resource entities
     */
    getAll(): IResourceEntity[];
    /**
     * Query resources using a specification.
     *
     * Iterates through all resources and returns those that
     * satisfy the specification.
     *
     * @typeParam T - The expected resource entity type
     * @param specification - The specification to filter by
     * @returns Array of matching resource entities
     */
    query<T extends IResourceEntity>(specification: ISpecification<T>): T[];
    /**
     * Check if a resource exists by ID.
     *
     * @param id - The unique resource identifier
     * @returns True if the resource exists
     */
    exists(id: string): boolean;
    /**
     * Register a resource in the repository.
     *
     * The Identity Map ensures the same resource is not registered twice.
     *
     * @param resource - The resource entity to register
     * @throws DuplicateResourceError if resource with same ID already exists
     */
    register(resource: IResourceEntity): void;
    /**
     * Unregister a resource from the repository.
     *
     * @param id - The unique resource identifier to unregister
     * @returns True if the resource was unregistered, false if not found
     */
    unregister(id: string): boolean;
    /**
     * Get the count of registered resources.
     *
     * @returns The number of registered resources
     */
    count(): number;
    /**
     * Clear all resources from the repository.
     *
     * Use with caution - this removes all cached resources.
     */
    clear(): void;
}
/**
 * Typed repository wrapper for specific resource types.
 *
 * Provides a type-safe interface for working with a specific
 * resource type, delegating to the main repository.
 *
 * @typeParam T - The resource entity type this repository manages
 */
export declare class TypedResourceRepository<T extends IResourceEntity> implements ITypedResourceRepository<T> {
    private readonly repository;
    private readonly resourceType;
    /**
     * Create a new typed repository.
     *
     * @param repository - The main repository to delegate to
     * @param resourceType - The resource type this repository manages
     */
    constructor(repository: IResourceRepository, resourceType: ResourceType);
    /**
     * Get a resource by its unique identifier.
     *
     * @param id - The unique resource identifier
     * @returns The resource entity
     * @throws ResourceNotFoundException if resource does not exist
     */
    getById(id: string): T;
    /**
     * Get a resource by its unique identifier, or null if not found.
     *
     * @param id - The unique resource identifier
     * @returns The resource entity or null
     */
    getByIdOrNull(id: string): T | null;
    /**
     * Get all resources of this type.
     *
     * @returns Array of all resource entities of this type
     */
    getAll(): T[];
    /**
     * Query resources using a specification.
     *
     * Only queries resources of this type.
     *
     * @param specification - The specification to filter by
     * @returns Array of matching resource entities
     */
    query(specification: ISpecification<T>): T[];
    /**
     * Check if a resource exists by ID.
     *
     * @param id - The unique resource identifier
     * @returns True if the resource exists
     */
    exists(id: string): boolean;
    /**
     * Get the count of resources of this type.
     *
     * @returns The number of resources of this type
     */
    count(): number;
}
/**
 * Factory for creating typed repositories.
 *
 * Caches typed repository instances to avoid creating
 * multiple wrappers for the same type.
 */
export declare class ResourceRepositoryFactory implements IResourceRepositoryFactory {
    private readonly repository;
    /** Cache of typed repositories by resource type */
    private readonly cache;
    /**
     * Create a new repository factory.
     *
     * @param repository - The main repository to create typed wrappers for
     */
    constructor(repository: IResourceRepository);
    /**
     * Get a typed repository for a specific resource type.
     *
     * Returns a cached instance if available.
     *
     * @typeParam T - The resource entity type
     * @param type - The resource type
     * @returns A typed repository for the specified type
     */
    getRepository<T extends IResourceEntity>(type: ResourceType): ITypedResourceRepository<T>;
}
