"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 equals(_name, _expression) {
		let [ expression ] = validateArguments(arguments, {
			expression: [ required, isValueExpression ]
		});
		
		return node({ type: "condition", conditionType: "equals", expression: expression });
	};
};
