import { type ValidationResult } from '@pawel-up/jexl';
import type { DomainProperty } from '@api-client/core/modeling/DomainProperty.js';
export interface FormulaTestRunResult {
    /**
     * Indicates if the formula evaluation was successful.
     * If false, the `message` property will contain the error message.
     */
    error: boolean;
    /**
     * An error message if the evaluation failed.
     */
    message?: string;
    /**
     * The result of the formula evaluation.
     * This can be a string, number, boolean, Date, or null.
     */
    value: string | number | boolean | Date | null | undefined;
}
/**
 * A class to parse and validate formulas from the calculated fields.
 */
export declare class FormulaParser {
    formula: string;
    property: DomainProperty;
    /**
     * A map of properties available in the entity.
     * The keys are property keys, and the values are DomainProperty objects.
     * This allows for quick lookup of properties by their keys.
     */
    protected properties: Map<string, DomainProperty>;
    constructor(formula: string, property: DomainProperty, properties?: DomainProperty[]);
    /**
     * Parses the formula and returns the validation result.
     */
    validate(): ValidationResult;
    test(dependencies?: string[]): Promise<FormulaTestRunResult | null>;
    private getJexlExpression;
    /**
     * Builds a test context for evaluating the formula.
     * This context includes the values of the properties that are dependencies of the formula.
     * @param dependencies The list of property keys that are dependencies in the formula.
     * @returns An object containing the property values for testing.
     */
    buildTestContext(dependencies: string[] | undefined): Record<string, unknown>;
    /**
     * Registers appropriate Jexl functions based on the data type.
     * @param jexl The Jexl instance to register functions on.
     */
    private registerFunctions;
    /**
     * Extracts property dependencies from the formula.
     * This method looks for {{field_name}} patterns in the original formula string.
     * @returns The list of unique dependency keys.
     */
    extractDependencies(): string[];
}
//# sourceMappingURL=formula_parser.d.ts.map