"use strict";

const wrapError = require("@validatem/wrap-error");
const either = require("@validatem/either");
const isString = require("@validatem/is-string");

module.exports = function (operations) {
	const isObjectType = require("./is-object-type")(operations);
	const wrapWithOperation = require("./wrap-with-operation")(operations);
	
	return wrapError("Must be a collection name or object", either([
		[ isObjectType("collection") ],
		[ isString, wrapWithOperation("collection") ]
	]));
};
