"use strict";

const wrapError = require("@validatem/wrap-error");
const ValidationError = require("@validatem/error");

module.exports = function (operations) {
	const isIndexType = require("./is-index-type")(operations);

	return wrapError("Must be a composite index type", [
		isIndexType,
		(node) => {
			if (node.composite !== true) {
				return new ValidationError(`Must be a composite index`);
			}
		}
	]);
};
