/**
 * Domain-Specific Utility Types
 *
 * Utility types for domain operations and transformations
 */
import { Id } from '../value-objects/Id';
import { Timestamp } from '../value-objects/Timestamp';
import { Money } from '../value-objects/Money';
import { Email } from '../value-objects/Email';
import { PhoneNumber } from '../value-objects/PhoneNumber';
import { Address } from '../value-objects/Address';
import { Status } from '../enums/Status';
import { Priority } from '../enums/Priority';
/**
 * Domain Entity Utilities
 */
export declare namespace DomainUtils {
    /**
     * Type for entities that can be created
     */
    type CreatableEntity<T extends {
        id: Id;
    }> = Omit<T, 'id' | 'createdAt' | 'updatedAt'>;
    /**
     * Type for entities that can be updated
     */
    type UpdatableEntity<T extends {
        id: Id;
        updatedAt: Timestamp;
    }> = Partial<Omit<T, 'id' | 'createdAt' | 'updatedAt'>>;
    /**
     * Type for entities that can be deleted
     */
    type DeletableEntity<T extends {
        id: Id;
        status: Status;
    }> = Pick<T, 'id'> & {
        status: Status.DELETED;
        deletedAt: Timestamp;
    };
    /**
     * Type for entities with audit trail
     */
    type AuditableEntity<T> = T & {
        createdBy: Id;
        updatedBy?: Id;
        deletedBy?: Id;
    };
    /**
     * Type for entities with tenant isolation
     */
    type TenantEntity<T> = T & {
        tenantId: Id;
    };
    /**
     * Type for entities with versioning
     */
    type VersionedEntity<T> = T & {
        version: number;
    };
}
/**
 * Domain Query Utilities
 */
export declare namespace QueryUtils {
    /**
     * Base query interface
     */
    interface BaseQuery {
        limit?: number;
        offset?: number;
        sortBy?: string;
        sortOrder?: 'asc' | 'desc';
    }
    /**
     * Filter query interface
     */
    interface FilterQuery extends BaseQuery {
        filters: Record<string, any>;
    }
    /**
     * Search query interface
     */
    interface SearchQuery extends BaseQuery {
        search: string;
        searchFields: string[];
    }
    /**
     * Date range query interface
     */
    interface DateRangeQuery extends BaseQuery {
        startDate: Timestamp;
        endDate: Timestamp;
    }
    /**
     * Pagination result interface
     */
    interface PaginatedResult<T> {
        data: T[];
        total: number;
        page: number;
        pageSize: number;
        totalPages: number;
    }
}
/**
 * Domain Validation Utilities
 */
export declare namespace ValidationUtils {
    /**
     * Validation result interface
     */
    interface ValidationResult {
        isValid: boolean;
        errors: ValidationError[];
    }
    /**
     * Validation error interface
     */
    interface ValidationError {
        field: string;
        message: string;
        code: string;
    }
    /**
     * Validation rule interface
     */
    interface ValidationRule<T> {
        validate(value: T): ValidationResult;
    }
    /**
     * Composite validation rule
     */
    class CompositeValidationRule<T> implements ValidationRule<T> {
        private rules;
        constructor(rules: ValidationRule<T>[]);
        validate(value: T): ValidationResult;
    }
}
/**
 * Domain Event Utilities
 */
export declare namespace EventUtils {
    /**
     * Event handler interface
     */
    interface EventHandler<T = any> {
        handle(event: T): Promise<void>;
    }
    /**
     * Event bus interface
     */
    interface EventBus {
        publish<T>(event: T): Promise<void>;
        subscribe<T>(eventType: string, handler: EventHandler<T>): void;
        unsubscribe(eventType: string, handler: EventHandler): void;
    }
    /**
     * Event metadata interface
     */
    interface EventMetadata {
        correlationId: string;
        causationId?: string;
        userId?: Id;
        tenantId?: Id;
        timestamp: Timestamp;
    }
}
/**
 * Domain Repository Utilities
 */
export declare namespace RepositoryUtils {
    /**
     * Base repository interface
     */
    interface BaseRepository<T, ID = Id> {
        findById(id: ID): Promise<T | null>;
        findAll(query?: QueryUtils.BaseQuery): Promise<T[]>;
        save(entity: T): Promise<T>;
        delete(id: ID): Promise<boolean>;
    }
    /**
     * Repository with pagination
     */
    interface PaginatedRepository<T, ID = Id> extends BaseRepository<T, ID> {
        findPaginated(query: QueryUtils.BaseQuery): Promise<QueryUtils.PaginatedResult<T>>;
    }
    /**
     * Repository with search
     */
    interface SearchableRepository<T, ID = Id> extends BaseRepository<T, ID> {
        search(query: QueryUtils.SearchQuery): Promise<T[]>;
    }
    /**
     * Repository with filtering
     */
    interface FilterableRepository<T, ID = Id> extends BaseRepository<T, ID> {
        findByFilters(query: QueryUtils.FilterQuery): Promise<T[]>;
    }
}
/**
 * Domain Service Utilities
 */
export declare namespace ServiceUtils {
    /**
     * Base service interface
     */
    interface BaseService<T extends {
        id: Id;
        updatedAt: Timestamp;
    }, ID = Id> {
        getById(id: ID): Promise<T | null>;
        getAll(query?: QueryUtils.BaseQuery): Promise<T[]>;
        create(data: DomainUtils.CreatableEntity<T>): Promise<T>;
        update(id: ID, data: DomainUtils.UpdatableEntity<T>): Promise<T>;
        delete(id: ID): Promise<boolean>;
    }
    /**
     * Service with business logic
     */
    interface BusinessService<T extends {
        id: Id;
        updatedAt: Timestamp;
    }, ID = Id> extends BaseService<T, ID> {
        validate(data: any): ValidationUtils.ValidationResult;
        process(data: T): Promise<T>;
    }
    /**
     * Service with events
     */
    interface EventDrivenService<T extends {
        id: Id;
        updatedAt: Timestamp;
    }, ID = Id> extends BaseService<T, ID> {
        publishEvent(event: any): Promise<void>;
    }
}
/**
 * Domain DTO Utilities
 */
export declare namespace DTOUtils {
    /**
     * Base DTO interface
     */
    interface BaseDTO {
        id?: string;
        createdAt?: string;
        updatedAt?: string;
    }
    /**
     * Create DTO interface
     */
    type CreateDTO<T> = Omit<T, 'id' | 'createdAt' | 'updatedAt'>;
    /**
     * Update DTO interface
     */
    type UpdateDTO<T> = Partial<Omit<T, 'id' | 'createdAt' | 'updatedAt'>>;
    /**
     * Response DTO interface
     */
    interface ResponseDTO<T> {
        success: boolean;
        data?: T;
        error?: string;
        timestamp: string;
    }
    /**
     * Paginated response DTO interface
     */
    interface PaginatedResponseDTO<T> extends ResponseDTO<T[]> {
        pagination: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
    }
}
/**
 * Domain Type Guards
 */
export declare namespace TypeGuards {
    /**
     * Check if value is a valid ID
     */
    const isValidId: (value: any) => value is Id;
    /**
     * Check if value is a valid Timestamp
     */
    const isValidTimestamp: (value: any) => value is Timestamp;
    /**
     * Check if value is a valid Money
     */
    const isValidMoney: (value: any) => value is Money;
    /**
     * Check if value is a valid Email
     */
    const isValidEmail: (value: any) => value is Email;
    /**
     * Check if value is a valid PhoneNumber
     */
    const isValidPhoneNumber: (value: any) => value is PhoneNumber;
    /**
     * Check if value is a valid Address
     */
    const isValidAddress: (value: any) => value is Address;
    /**
     * Check if value is a valid Status
     */
    const isValidStatus: (value: any) => value is Status;
    /**
     * Check if value is a valid Priority
     */
    const isValidPriority: (value: any) => value is Priority;
}
/**
 * Domain Transformation Utilities
 */
export declare namespace TransformUtils {
    /**
     * Transform entity to DTO
     */
    const entityToDTO: <T extends {
        id: Id;
        createdAt: Timestamp;
        updatedAt: Timestamp;
    }>(entity: T) => DTOUtils.BaseDTO;
    /**
     * Transform DTO to entity
     */
    const dtoToEntity: <T>(dto: DTOUtils.BaseDTO, entityFactory: (data: any) => T) => T;
    /**
     * Transform entity to API response
     */
    const entityToResponse: <T>(entity: T) => DTOUtils.ResponseDTO<T>;
    /**
     * Transform error to API response
     */
    const errorToResponse: (error: Error) => DTOUtils.ResponseDTO<never>;
}
//# sourceMappingURL=DomainUtils.d.ts.map