import { EastFunction } from '../functions'; import { BooleanType, EastType, EastTypeOf, PrimitiveValue, ValueTypeOf } from '../types'; import { Expression } from './core'; /** * Return x1 of predicate is true, or x2 otherwise * * @param predicate the {@link Expression} to test * @param x1 the return value if `predicate` is `true` * @param x2 the return value if `predicate` is `false` * * @category Expression * * @example * ```typescript * // ... * // if name is null, replace with 'Unknown' string * new_name: IfElse( * Equal(Variable('name', Nullable(StringType)), Null(StringType)), * Const('Unknown'), * Variable('name', StringType) * ), * // ... * ``` */ export declare function IfElse(predicate: EastFunction, x1: F1, x2: F2 & ((F1["type"] & F2["type"]) extends never ? never : unknown)): EastFunction; export declare function IfElse(predicate: EastFunction, x1: T1, x2: F2 & ((EastTypeOf & F2["type"]) extends never ? never : unknown)): EastFunction & F2["type"] : never>; export declare function IfElse(predicate: EastFunction, x1: F1, x2: T2 & ((F1["type"] & EastTypeOf) extends never ? never : unknown)): EastFunction : never>; export declare function IfElse(predicate: EastFunction, x1: T1, x2: T2): EastFunction> & EastFunction>; /** * Return `true` if `value` is `false`, or `false` otherwise. * * @param value the {@link Expression} to apply * * @category Expression * * @example * ```typescript * // ... * NotActive: Not(Variable('Active', BooleanType)), * // ... * ``` */ export declare function Not(value: Expression): EastFunction; /** * Return `true` if all `values` are `true`, or `false` otherwise. * * @param value one or more {@link Expression}'s to apply * * @category Expression * * @example * ```typescript * // ... * // set an employee availability to true if they are a "Site Worker" AND they started more than 6 months ago * Available: And( * Equal( * Variable('EmployeeCategory', 'strings'), * Const("Site Worker") * ), * Greater( * Duration( * Variable('StartDate', DateTimeType), * Variable('ContractDate', DateTimeType), * 'month' * ), * 6 * ) * ), * // ... * ``` */ export declare function And(): EastFunction; export declare function And(first: EastFunction): EastFunction; export declare function And(first: EastFunction, second: EastFunction): EastFunction; export declare function And(first: EastFunction, second: EastFunction, third: EastFunction): EastFunction; export declare function And(first: EastFunction, second: EastFunction, third: EastFunction, fourth: EastFunction): EastFunction; export declare function And(first: EastFunction, second: EastFunction, third: EastFunction, fourth: EastFunction, fifth: EastFunction): EastFunction; /** * Return `false` if all `values` are `false`, or `true` otherwise. * * @param value one or more {@link Expression}'s to apply * * @category Expression * * @example * ```typescript * // ... * // set an employee availability to true if they are a "Site Worker" OR they started more than 6 months ago * Available: Or( * Equal( * Variable('EmployeeCategory', StringType), * Const("Site Worker") * ), * Greater( * Duration( * Variable('StartDate', DateTimeType), * Variable('ContractDate', DateTimeType), * 'month' * ), * 6 * ) * ), * // ... * ``` */ export declare function Or(): EastFunction; export declare function Or(first: EastFunction): EastFunction; export declare function Or(first: EastFunction, second: EastFunction): EastFunction; export declare function Or(first: EastFunction, second: EastFunction, third: EastFunction): EastFunction; export declare function Or(first: EastFunction, second: EastFunction, third: EastFunction, fourth: EastFunction): EastFunction; export declare function Or(first: EastFunction, second: EastFunction, third: EastFunction, fourth: EastFunction, fifth: EastFunction): EastFunction; /** * Compare two values and return `true` if equal, or `false` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if an employee is a "Site Worker" * IsSiteWorker: Equal( * Variable('EmployeeCategory', StringType), * Const("Site Worker") * ), * // ... * ``` */ export declare function Equal(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function Equal(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function Equal(first: EastFunction, second: EastFunction): EastFunction; export declare function Equal(first: EastFunction, second: EastFunction): EastFunction; /** * Compare two values and return `false` if equal, or `true` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if an employee isn't a "Site Worker" * IsNotSiteWorker: NotEqual( * Variable('EmployeeCategory', StringType), * Const("Site Worker") * ), * // ... * ``` */ export declare function NotEqual(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function NotEqual(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function NotEqual(first: EastFunction, second: EastFunction): EastFunction; export declare function NotEqual(first: EastFunction, second: EastFunction): EastFunction; /** * Compare two values and return `true` if the first is less than the second, or `false` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if cost is less than a price * IsProfitable: Less( * Variable('Cost', FloatType), * Variable('Price', FloatType) * ), * // ... * ``` */ export declare function Less(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function Less(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function Less(first: EastFunction, second: EastFunction): EastFunction; export declare function Less(first: EastFunction, second: EastFunction): EastFunction; /** * Compare two values and return `true` if the first is less than or equal to the second, or `false` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if purchase price is less than or equal to bank balance * CanPurchase: LessEqual( * Variable('Price', FloatType), * Variable('Balance', FloatType) * ), * // ... * ``` */ export declare function LessEqual(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function LessEqual(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function LessEqual(first: EastFunction, second: EastFunction): EastFunction; export declare function LessEqual(first: EastFunction, second: EastFunction): EastFunction; /** * Compare two values and return `true` if the first is greater than the second, or `false` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if more than 8 hours were worked * IsOvertime: Greater( * Variable('HoursWorked', FloatType), * 8 * ), * // ... * ``` */ export declare function Greater(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function Greater(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function Greater(first: EastFunction, second: EastFunction): EastFunction; export declare function Greater(first: EastFunction, second: EastFunction): EastFunction; /** * Compare two values and return `true` if the first is greater than or equal to the second, or `false` otherwise. * * @param first the first {@link Expression} to compare * @param second the second {@link Expression} to compare * * @category Expression * * @example * ```typescript * // ... * // return true if balance is greater or equal to zero. * IsSolvent: GreaterEqual( * Variable('Balance', FloatType), * 0 * ), * // ... * ``` */ export declare function GreaterEqual(first: EastFunction, second: ValueTypeOf): EastFunction; export declare function GreaterEqual(first: ValueTypeOf, second: EastFunction): EastFunction; export declare function GreaterEqual(first: EastFunction, second: EastFunction): EastFunction; export declare function GreaterEqual(first: EastFunction, second: EastFunction): EastFunction;