import { ComponentType, SystemValue } from '@opentext/forms-common'; /** * Supported data types for conditions and functions */ declare enum DATA_TYPES { STRING = "string", NUMBER = "number", INTEGER = "integer", DECIMAL = "decimal", BIGINT = "bigint", NUMERIC = "numeric", CURRENCY = "currency", BOOLEAN = "boolean", DATE = "date", DATETIME = "datetime", ARRAY = "array", INHERIT = "inherit" } /** * Constraint operation keys for type-safe references */ declare enum CONSTRAINT_KEYS { ALL_OF = "all_of", ANY_OF = "any_of", ONE_OF = "one_of", NONE_OF = "none_of", CONTAINS = "contains", STARTS_WITH = "starts_with", ENDS_WITH = "ends_with", IS_EMPTY = "is_empty", IS_NOT_EMPTY = "is_not_empty", LENGTH = "length", IS_EQUAL_TO = "is_equal_to", IS_NOT_EQUAL_TO = "is_not_equal_to", IS_GREATER_THAN = "is_greater_than", IS_LESS_THAN = "is_less_than", IS_GREATER_THAN_OR_EQUAL_TO = "is_greater_than_or_equal_to", IS_LESS_THAN_OR_EQUAL_TO = "is_less_than_or_equal_to", IS_AFTER = "is_after", IS_BEFORE = "is_before", IGNORE_CASE = "ignore_case", IN = "in", NOT_IN = "not_in", CONCATENATE = "concatenate", TO_LOWER_CASE = "to_lower_case", TO_UPPER_CASE = "to_upper_case", TRIM = "trim", ADD = "add", SUBTRACT = "subtract", MULTIPLY_BY = "multiply_by", DIVIDE_BY = "divide_by", ABSOLUTE_VALUE_OF = "absolute_value_of", COUNT = "count", SUM = "sum", MAX = "max", MIN = "min", MEAN = "mean", PRODUCT = "product" } interface Constraint { name: string; components: ComponentRow[]; } interface ComponentRow { component: any; dataType: string; default: string; 'ot2mc-row-id': string; allowUserInput: boolean; isRepeating: boolean; } interface ConstraintComponent { text: string; value: string; type: ComponentType; outputDataType: string; applicableDataTypes: string[]; allowUserInput: boolean; unsupportedComponentTypes?: ComponentType[]; overrideUnsupportedKeys?: CONSTRAINT_KEYS[]; tooltip: string; arrayItemDataType?: string[]; } interface ConstraintComponentModel { id: string; schemaId: string; data: ConstraintComponent; } /** * Configuration for a constraint component */ interface ConstraintConfig { id: string; /** * Type of the component (comparison, function, system value, etc.) */ type: ComponentType; /** * Data types applicable for this component */ applicableDataTypes: string[]; /** * The output/return type this component produces */ outputDataType: string; /** * Whether user input is allowed for this component */ allowUserInput: boolean; /** * Component types that are not supported with this component */ unsupportedComponentTypes: ComponentType[]; /** * Component keys that override exclusion rules for this component */ overrideUnsupportedKeys?: CONSTRAINT_KEYS[]; /** * Tooltip or description for this component */ tooltip: string; /** * If the config supports array types, this specifies the data type of the items within the array */ arrayItemDataType?: string[]; } interface ConstraintsConfigType { conditions: Record; functions: Record; systemValues: Record; } /** * Generates a unique ID for a condition configuration. * Format: exp-{type-prefix}-{uuid} */ declare function generateComponentId(type: ComponentType): string; /** * Returns the prefix for a given component type * @param type The constraint component type * @returns The prefix string */ declare function getPrefixForComponentId(type: ComponentType): string; /** * Get entire constraint configs */ declare function getAllConstraintConfigs(): Record; /** * Returns condition configs applicable for a specific data type * @param dataType The data type to filter conditions by * @returns {Record} Condition configs applicable for the specified data type */ declare function getConditionConfigsForDataType(dataType: string): Record; /** * Returns function configs applicable for a specific data type * @param dataType The data type to filter functions by * @returns {Record} Function configs applicable for the specified data type */ declare function getFunctionConfigsForDataType(dataType: string): Record; /** * Returns system value configs applicable for a specific data type * @param dataType The data type to filter system values by * @returns {Record} System value configs applicable for the specified data type */ declare function getSystemValueConfigsForDataType(dataType: string): Record; /** * Returns the ID associated with a given component key */ declare function getIdForConstraintKey(componentKey: string): string | undefined; /** * Returns all supported data types * @returns {string[]} Array of supported data types */ declare function getAllSupportedDataTypes(): string[]; /** * Retrieves the tooltip for a given constraint key * @param componentKey The key of the constraint component (condition, function, or system value) * @returns The tooltip string if found, otherwise undefined */ declare function getTooltipForConstraintKey(componentKey: string): string | undefined; /** * Helper function to get default value based on data type * @param dataType The data type to get the default value for * @returns The default value corresponding to the specified data type */ declare function getDefaultValueByDataType(dataType: string): any; export { DATA_TYPES, SystemValue, CONSTRAINT_KEYS, ConstraintsConfigType, ConstraintConfig, Constraint, ComponentRow, ConstraintComponent, ConstraintComponentModel, generateComponentId, getIdForConstraintKey, getPrefixForComponentId, getAllConstraintConfigs, getConditionConfigsForDataType, getFunctionConfigsForDataType, getSystemValueConfigsForDataType, getAllSupportedDataTypes, getTooltipForConstraintKey, getDefaultValueByDataType };