"use strict";

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

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

module.exports = function (operations) {
	const isObjectType = require("../../validators/operations/is-object-type")(operations);

	return function deleteField(_restoreOperation) {
		let [ restoreOperation ] = validateArguments(arguments, {
			restoreOperation: [ required, isObjectType("restoreAs") ]
		});

		return node({
			type: "deleteField",
			restoreOperation: restoreOperation
		});
	};
};
