// ConditionEvaluator.js

export class ConditionEvaluator {

    static check(conditions = [], data = {}) {

        return conditions.every(condition => {

            const actual =
                data[condition.field_name];

            const expected =
                condition.expected_value;

            switch (condition.operator) {

                case '>=':

                    return actual >= expected;

                case '=':

                    return actual == expected;

                case 'contains':

                    return String(actual)
                        .includes(expected);

                default:

                    return false;
            }
        });
    }
}
