"use strict";

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

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

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

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