"use strict";

const matchValue = require("match-value");

const addCommonFields = require("../event-add-common-fields");

module.exports = function mapJoinRulesEvent(event, _context) {
	return addCommonFields(event, {
		type: "joinRuleChanged",
		sender: event.sender,
		access: matchValue(event.content.join_rule, {
			public: "public",
			invite: "inviteOnly"
		})
	});
};
