import { Jexl } from '@pawel-up/jexl/Jexl.js';
import type { DomainEntity } from '../../modeling/DomainEntity.js';
import { type AppliedDataSemantic, type SemanticCondition, SemanticOperation, SemanticType } from '../../modeling/Semantics.js';
import type { TransformFunction } from '@pawel-up/jexl';
/**
 * Get or create a JEXL instance with optional custom transforms
 */
export declare function getJexlInstance(transforms?: Record<string, TransformFunction>): Jexl;
/**
 * Context object passed to semantic condition evaluation
 */
export interface SemanticExecutionContext {
    /**
     * The entity data being processed
     */
    entity: Record<string, unknown>;
    /**
     * Current user context (if authenticated)
     */
    user?: {
        id?: string;
        authenticated?: boolean;
        roles?: string[];
        [key: string]: unknown;
    };
    /**
     * The current database operation
     */
    operation: SemanticOperation;
    /**
     * Applied semantics with their field mappings
     */
    appliedSemantics: AppliedDataSemantic[];
    /**
     * Configuration for the current semantic being evaluated
     */
    config?: Record<string, unknown>;
}
/**
 * Builds a semantics object for JEXL evaluation that maps semantic types to actual field names.
 *
 * The resulting map should be used in JEXL expressions to reference semantic fields.
 *
 * @returns A map where keys are semantic type identifiers and values are the field names.
 *
 * @example
 * const semanticFieldMap = buildSemanticFieldMap(entity);
 * const result = await jexl.eval("semantics.CreatedTimestamp == null", {
 *  semantics: semanticFieldMap,
 *  ...
 * }
 */
export declare function buildSemanticFieldMap(entity: DomainEntity): Record<string, string>;
/**
 * Evaluates a semantic condition against the execution context
 * In a real implementation, this would use JEXL to evaluate the expression
 *
 * @param condition The semantic condition to evaluate
 * @param context The execution context containing entity data, user info, etc.
 * @param semanticFieldMap A map of semantic field names to their actual field names.
 *                         Use the `buildSemanticFieldMap()` function to create this map.
 * @param jexl Optional JEXL instance to use for evaluation, defaults to a cached instance.
 * @returns A promise that resolves to true if the condition is met, false otherwise
 */
export declare function evaluateSemanticCondition(condition: SemanticCondition, context: SemanticExecutionContext, semanticFieldMap: Record<string, string>, jexl?: Jexl): Promise<boolean>;
/**
 * Check if semantic should execute based on all its conditions
 *
 * @param semantic The semantic to check
 * @param context The execution context containing entity data, user info, etc.
 * @param semanticFieldMap A map of semantic field names to their actual field names.
 *                         Use the `buildSemanticFieldMap()` function to create this map.
 * @return A promise that resolves to true if all conditions are met, false otherwise
 */
export declare function shouldSemanticExecute(semantic: AppliedDataSemantic, context: SemanticExecutionContext, semanticFieldMap: Record<string, string>): Promise<boolean>;
/**
 * Helper to get the actual field name for a semantic type
 */
export declare function getFieldNameForSemantic(semanticType: SemanticType, semanticFieldMap: Record<string, string>): string | undefined;
/**
 * Validates that all semantic references in conditions are available
 */
export declare function validateSemanticConditions(semantic: AppliedDataSemantic, semanticFieldMap: Record<string, string>): string[];
//# sourceMappingURL=Semantics.d.ts.map