"use strict";

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

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

module.exports = function (operations) {
	const isRemoteField = require("../../validators/operations/is-remote-field")(operations);

	return function linkTo(_field) {
		let [ field ] = validateArguments(arguments, {
			field: [ required, isRemoteField ]
		});

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