"use strict";

const { validateArguments } = require("@validatem/core");
const required = require("@validatem/required");

const node = require("../ast-node");

module.exports = function (operations) {
	const isConditionValue = require("../validators/operations/is-condition-value")(operations);

	return function lessThan(_name, _expression) {
		let [ expression ] = validateArguments(arguments, {
			expression: [ required, isConditionValue ]
		});
		
		// FIXME: Calling it `expression` is super confusing. That needs a better name.
		return node({ type: "condition", conditionType: "lessThan", expression: expression });
	};
};
