/**
 * Resource Decorator Types for Declarative Infrastructure API
 *
 * This module defines the interfaces for the Decorator pattern,
 * enabling cross-cutting concerns to be added to resources without
 * modifying their code.
 *
 * @module declarative-api/decorator.types
 */
import type { IResourceEntity } from './resource.types';
import type { ISpecification } from './specification.types';
/**
 * Decorator type discriminator for built-in decorators.
 *
 * Each decorator type represents a specific cross-cutting concern:
 * - logging: Adds logging behavior to resource operations
 * - metrics: Adds metrics collection for resource operations
 * - tagging: Adds AWS tags to resources
 * - encryption: Adds encryption configuration to resources
 * - custom: User-defined decorator behavior
 *
 * Validates: Requirements 9.1
 */
export type DecoratorType = 'logging' | 'metrics' | 'tagging' | 'encryption' | 'custom';
/**
 * All decorator type strings as a readonly array.
 * Useful for validation and iteration.
 */
export declare const DECORATOR_TYPES: readonly DecoratorType[];
/**
 * Type guard to check if a value is a valid DecoratorType.
 *
 * @param value - The value to check
 * @returns True if the value is a valid DecoratorType
 *
 * @example
 * ```typescript
 * if (isDecoratorType(value)) {
 *   // value is DecoratorType
 * }
 * ```
 */
export declare function isDecoratorType(value: unknown): value is DecoratorType;
/**
 * Decorator priority constants.
 *
 * Lower values execute earlier. Use these constants for consistent ordering
 * when composing multiple decorators.
 */
export declare const DECORATOR_PRIORITIES: {
    /** Highest priority - executes first (e.g., validation) */
    readonly HIGHEST: 0;
    /** High priority - executes early (e.g., encryption) */
    readonly HIGH: 100;
    /** Normal priority - default execution order (e.g., tagging) */
    readonly NORMAL: 500;
    /** Low priority - executes late (e.g., logging) */
    readonly LOW: 900;
    /** Lowest priority - executes last (e.g., metrics) */
    readonly LOWEST: 1000;
};
/**
 * Type for decorator priority values.
 */
export type DecoratorPriority = (typeof DECORATOR_PRIORITIES)[keyof typeof DECORATOR_PRIORITIES] | number;
/**
 * Result of a decorator application.
 */
export interface DecoratorResult {
    /** Whether the decorator was applied successfully */
    readonly applied: boolean;
    /** The decorator type that was applied */
    readonly decoratorType: DecoratorType;
    /** Optional message describing the result */
    readonly message?: string;
    /** Timestamp when the decorator was applied */
    readonly timestamp: Date;
}
/**
 * Resource Decorator interface.
 *
 * Decorators add cross-cutting concerns to resources without modifying
 * their code. They wrap Resource_Entity and can be composed together.
 *
 * Implements: Decorator Pattern
 *
 * @example
 * ```typescript
 * class LoggingDecorator implements IResourceDecorator {
 *   readonly decoratorType = 'logging';
 *   readonly priority = DECORATOR_PRIORITIES.LOW;
 *
 *   decorate<T extends IResourceEntity>(resource: T): T {
 *     console.log(`Decorating resource: ${resource.id}`);
 *     return resource;
 *   }
 *
 *   shouldApply(resource: IResourceEntity): boolean {
 *     return true; // Apply to all resources
 *   }
 * }
 *
 * // Compose decorators
 * const decorated = new LoggingDecorator(new MetricsDecorator(resource));
 * ```
 *
 * Validates: Requirements 9.1, 9.5
 */
export interface IResourceDecorator {
    /**
     * Decorator type discriminator.
     */
    readonly decoratorType: DecoratorType;
    /**
     * Decorator priority (lower = earlier execution).
     *
     * Use DECORATOR_PRIORITIES constants for consistent ordering.
     */
    readonly priority: DecoratorPriority;
    /**
     * Wrap resource with decorator behavior.
     *
     * The decorator should add its cross-cutting concern to the resource
     * without modifying the Resource_Entity interface.
     *
     * @typeParam T - The resource entity type
     * @param resource - The resource to decorate
     * @returns The decorated resource (same type as input)
     */
    decorate<T extends IResourceEntity>(resource: T): T;
    /**
     * Check if decorator should apply to this resource.
     *
     * Allows conditional application based on resource type,
     * metadata, or other criteria.
     *
     * @param resource - The resource to check
     * @returns True if the decorator should be applied
     */
    shouldApply(resource: IResourceEntity): boolean;
}
/**
 * Extended decorator interface with specification-based conditional application.
 *
 * Allows decorators to use the Specification pattern for complex
 * conditional logic.
 *
 * Validates: Requirements 9.6
 */
export interface IConditionalDecorator extends IResourceDecorator {
    /**
     * Specification for conditional application.
     *
     * If provided, the decorator will only apply when the specification
     * is satisfied by the resource.
     */
    readonly specification?: ISpecification<IResourceEntity>;
}
/**
 * Decorator registry interface for managing decorators.
 *
 * Provides methods to register, unregister, and query decorators.
 */
export interface IDecoratorRegistry {
    /**
     * Register a decorator.
     *
     * @param decorator - The decorator to register
     */
    register(decorator: IResourceDecorator): void;
    /**
     * Unregister a decorator by type.
     *
     * @param decoratorType - The decorator type to unregister
     * @returns True if decorator was unregistered, false if not found
     */
    unregister(decoratorType: DecoratorType): boolean;
    /**
     * Get all registered decorators sorted by priority.
     *
     * @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.
     */
    clear(): void;
}
/**
 * Decorator composition result for tracking application.
 */
export interface DecoratorCompositionResult {
    /** Total number of decorators in the composition */
    readonly totalDecorators: number;
    /** Number of decorators that were applied */
    readonly appliedCount: number;
    /** Number of decorators that were skipped */
    readonly skippedCount: number;
    /** Individual results for each decorator */
    readonly results: readonly DecoratorResult[];
    /** The final decorated resource */
    readonly resource: IResourceEntity;
}
/**
 * Decorator composer interface for applying multiple decorators.
 *
 * Handles the composition of multiple decorators in priority order.
 */
export interface IDecoratorComposer {
    /**
     * Apply all registered decorators to a resource.
     *
     * Decorators are applied in priority order (ascending).
     * Each decorator's shouldApply is checked before application.
     *
     * @typeParam T - The resource entity type
     * @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.
     *
     * @typeParam T - The resource entity type
     * @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;
}
