"use strict";

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

const isLocalFieldName = require("../validators/is-local-field-name");

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

module.exports = function field(_operations) {
	return function (_name) {
		let [ name ] = validateArguments(arguments, {
			name: [ required, isLocalFieldName ]
		});

		return node({ type: "field", name });
	};
};
