"use strict";

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

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

module.exports = function (operations) {
	const isFieldsObject = require("../../validators/operations/schema/is-fields-object")(operations);

	return function fields(_fields) {
		let [ fields ] = validateArguments(arguments, {
			fields: [ required, isFieldsObject ]
		});

		return node({
			type: "schemaFields",
			fields: fields
		});
	};
};
