"use strict";

const defaultTo = require("@validatem/default-to");
const either = require("@validatem/either");
const arrayOf = require("@validatem/array-of");

const tagAsType = require("../../validators/tag-as-type");

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

	return [
		either([
			[ isField, tagAsType("single") ],
			[ arrayOf(isField), tagAsType("composite") ],
		]),
		defaultTo({ type: "local" }),
	];
};
