"use strict";

const required = require("@validatem/required");
const isString = require("@validatem/is-string");
const isPlainObject = require("@validatem/is-plain-object");
const allowExtraProperties = require("@validatem/allow-extra-properties");

module.exports = function isEvent(strict = false, extraFields = {}) {
	let fields = {
		type: [ required, isString ],
		content: [ required, isPlainObject ],
		... extraFields
	};

	if (strict) {
		return fields;
	} else {
		return allowExtraProperties(fields);
	}
};
