/**
 * Resource Decorator Implementation
 *
 * This module provides the core decorator infrastructure including
 * the registry and composer for managing and applying decorators.
 *
 * @module declarative-api/decorator/decorator
 */
import type { IResourceDecorator, IDecoratorRegistry, IDecoratorComposer, DecoratorType, DecoratorPriority, DecoratorCompositionResult, IResourceEntity, ISpecification } from '../../../lib/runtime-web/types/declarative-api';
/**
 * Error thrown when a duplicate decorator is registered.
 */
export declare class DuplicateDecoratorError extends Error {
    readonly decoratorType: DecoratorType;
    constructor(decoratorType: DecoratorType);
}
/**
 * Type guard for DuplicateDecoratorError.
 */
export declare function isDuplicateDecoratorError(error: unknown): error is DuplicateDecoratorError;
/**
 * Base class for resource decorators.
 *
 * Provides default implementations for common decorator behavior.
 * Subclasses can override only the methods they need.
 *
 * @example
 * ```typescript
 * class MyDecorator extends BaseResourceDecorator {
 *   constructor() {
 *     super('custom', DECORATOR_PRIORITIES.NORMAL);
 *   }
 *
 *   decorate<T extends IResourceEntity>(resource: T): T {
 *     // Custom decoration logic
 *     return resource;
 *   }
 * }
 * ```
 */
export declare abstract class BaseResourceDecorator implements IResourceDecorator {
    readonly decoratorType: DecoratorType;
    readonly priority: DecoratorPriority;
    protected readonly specification?: ISpecification<IResourceEntity> | undefined;
    constructor(decoratorType: DecoratorType, priority: DecoratorPriority, specification?: ISpecification<IResourceEntity> | undefined);
    /**
     * Decorate a resource.
     * Subclasses must implement this method.
     *
     * @param resource - The resource to decorate
     * @returns The decorated resource
     */
    abstract decorate<T extends IResourceEntity>(resource: T): T;
    /**
     * Check if decorator should apply to this resource.
     *
     * If a specification is provided, uses it for the check.
     * Otherwise, returns true (apply to all resources).
     *
     * @param resource - The resource to check
     * @returns True if the decorator should be applied
     */
    shouldApply(resource: IResourceEntity): boolean;
}
/**
 * Decorator Registry implementation.
 *
 * Manages registration and retrieval of decorators.
 * Decorators are stored and returned in priority order.
 * When priorities are equal, registration order is used as a tiebreaker
 * to ensure stable, deterministic ordering.
 */
export declare class DecoratorRegistry implements IDecoratorRegistry {
    private readonly decorators;
    private registrationCounter;
    /**
     * Register a decorator.
     *
     * @param decorator - The decorator to register
     */
    register(decorator: IResourceDecorator): void;
    /**
     * Unregister all decorators of a type.
     *
     * @param decoratorType - The decorator type to unregister
     * @returns True if any decorators were unregistered
     */
    unregister(decoratorType: DecoratorType): boolean;
    /**
     * Get all registered decorators sorted by priority.
     * When priorities are equal, decorators are sorted by registration order
     * to ensure stable, deterministic ordering.
     *
     * @returns Array of decorators sorted by priority (ascending)
     */
    getAll(): readonly IResourceDecorator[];
    /**
     * Get decorators by type.
     *
     * @param type - The decorator type to filter by
     * @returns Array of decorators of the specified type
     */
    getByType(type: DecoratorType): readonly IResourceDecorator[];
    /**
     * Check if a decorator type is registered.
     *
     * @param decoratorType - The decorator type to check
     * @returns True if decorator is registered
     */
    has(decoratorType: DecoratorType): boolean;
    /**
     * Get the number of registered decorators.
     *
     * @returns The count of registered decorators
     */
    count(): number;
    /**
     * Clear all registered decorators.
     * Also resets the registration counter.
     */
    clear(): void;
}
/**
 * Decorator Composer implementation.
 *
 * Applies multiple decorators to resources in priority order.
 */
export declare class DecoratorComposer implements IDecoratorComposer {
    private readonly registry;
    constructor(registry: IDecoratorRegistry);
    /**
     * Apply all registered decorators to a resource.
     *
     * @param resource - The resource to decorate
     * @returns Composition result with decorated resource
     */
    compose<T extends IResourceEntity>(resource: T): DecoratorCompositionResult;
    /**
     * Apply specific decorators to a resource.
     *
     * @param resource - The resource to decorate
     * @param decorators - The decorators to apply
     * @returns Composition result with decorated resource
     */
    composeWith<T extends IResourceEntity>(resource: T, decorators: readonly IResourceDecorator[]): DecoratorCompositionResult;
}
