/**
 * Resource Entity and Value Object Types
 *
 * This module defines the base interfaces for resource entities and value objects
 * following DDD (Domain-Driven Design) patterns. These types are isomorphic and
 * can be used in both Lambda and browser contexts.
 *
 * @module declarative-api/resource.types
 */
import type { ResourceType, LifecycleStateType, ResourceMetadata } from './core.types';
/**
 * Lifecycle state interface for resource state management.
 *
 * Implements the State pattern for managing resource lifecycle.
 * Each state defines valid transitions and state-specific behavior.
 *
 * Validates: Requirements 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
 */
export interface ILifecycleState {
    /** Current state type */
    readonly stateType: LifecycleStateType;
    /**
     * Check if transition to target state is valid.
     *
     * @param targetState - The state to transition to
     * @returns True if the transition is valid
     */
    canTransitionTo(targetState: LifecycleStateType): boolean;
    /**
     * Get all valid transitions from current state.
     *
     * @returns Array of valid target states
     */
    getValidTransitions(): readonly LifecycleStateType[];
}
/**
 * Resource visitor interface for traversing resource trees.
 *
 * Implements the Visitor pattern for operations on resource hierarchies.
 * Each visit method handles a specific resource type.
 *
 * @typeParam T - The return type of visit operations
 *
 * Validates: Requirements 8.4
 */
export interface IResourceVisitor<T> {
    /** Visit a DynamoDB table resource */
    visitTable(entity: IResourceEntity): T;
    /** Visit an SQS queue resource */
    visitQueue(entity: IResourceEntity): T;
    /** Visit an SNS topic resource */
    visitTopic(entity: IResourceEntity): T;
    /** Visit an S3 bucket resource */
    visitBucket(entity: IResourceEntity): T;
    /** Visit a Cognito user pool resource */
    visitCognito(entity: IResourceEntity): T;
    /** Visit an EventBridge event bus resource */
    visitEventBus(entity: IResourceEntity): T;
    /** Visit a composite resource group */
    visitComposite(entity: IResourceEntity): T;
    /** Visit an unknown resource type */
    visitUnknown(entity: IResourceEntity): T;
}
/**
 * Base interface for all AWS resources as domain entities.
 *
 * Each resource has identity, lifecycle state, and construct reference.
 * This interface is generic to support different CDK construct types.
 *
 * Implements: DDD Entity, State Pattern
 *
 * @typeParam TConstruct - The CDK construct type (defaults to unknown for isomorphic usage)
 *
 * @example
 * ```typescript
 * // In CDK context with full construct access
 * interface ITableResourceEntity extends IResourceEntity<dynamodb.Table> {
 *   readonly tableName: string;
 *   readonly tableArn: string;
 * }
 *
 * // In isomorphic context without CDK dependency
 * const entity: IResourceEntity = {
 *   id: 'users-table',
 *   type: 'dynamodb:table',
 *   state: { stateType: 'created', ... },
 *   construct: undefined,
 *   metadata: { ... },
 * };
 * ```
 *
 * Validates: Requirements 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 18.6
 */
export interface IResourceEntity<TConstruct = unknown> {
    /** Unique identifier within the infrastructure context */
    readonly id: string;
    /** Resource type discriminator for type-safe handling */
    readonly type: ResourceType;
    /** Current lifecycle state */
    readonly state: ILifecycleState;
    /**
     * Underlying CDK construct (full access).
     *
     * In isomorphic contexts (browser), this may be undefined.
     * In CDK contexts, this provides full access to the construct.
     */
    readonly construct: TConstruct;
    /** Resource metadata (tags, stage, timestamps) */
    readonly metadata: ResourceMetadata;
    /**
     * Transition to a new lifecycle state.
     *
     * @param state - The target state type
     * @throws InvalidStateTransitionError if transition is not valid
     */
    transitionTo(state: LifecycleStateType): void;
    /**
     * Accept a visitor for traversal operations.
     *
     * @typeParam T - The return type of the visitor
     * @param visitor - The visitor to accept
     * @returns The result of the visitor operation
     */
    accept<T>(visitor: IResourceVisitor<T>): T;
}
/**
 * Base class for immutable resource configuration value objects.
 *
 * Value objects are immutable and compared by value, not identity.
 * They encapsulate resource configuration that doesn't change after creation.
 *
 * Implements: DDD Value Object
 *
 * @example
 * ```typescript
 * class TableConfig extends ResourceValueObject {
 *   constructor(
 *     readonly partitionKey: string,
 *     readonly sortKey?: string,
 *     readonly billingMode: 'PAY_PER_REQUEST' | 'PROVISIONED' = 'PAY_PER_REQUEST',
 *   ) {
 *     super();
 *   }
 *
 *   protected getEqualityComponents(): unknown[] {
 *     return [this.partitionKey, this.sortKey, this.billingMode];
 *   }
 * }
 * ```
 *
 * Validates: Requirements 18.6
 */
export declare abstract class ResourceValueObject {
    /**
     * Get the components used for equality comparison.
     *
     * Subclasses must implement this to return all properties
     * that should be considered for equality.
     *
     * @returns Array of values to compare for equality
     */
    protected abstract getEqualityComponents(): unknown[];
    /**
     * Check equality with another value object.
     *
     * Two value objects are equal if they have the same type
     * and all equality components are equal.
     *
     * @param other - The other value object to compare
     * @returns True if the value objects are equal
     */
    equals(other: ResourceValueObject): boolean;
    /**
     * Deep equality check for nested objects and arrays.
     *
     * @param a - First value
     * @param b - Second value
     * @returns True if values are deeply equal
     */
    private deepEquals;
    /**
     * Get a hash code for this value object.
     *
     * Used for efficient storage in hash-based collections.
     *
     * @returns A numeric hash code
     */
    getHashCode(): number;
    /**
     * Hash a single value.
     *
     * @param value - The value to hash
     * @returns A numeric hash
     */
    private hashValue;
}
