"use strict";

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

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

module.exports = function mapHistoryVisibilityEvent(event, _context) {
	return addCommonFields(event, {
		type: "historyVisibilityChanged",
		sender: event.sender,
		visibility: matchValue(event.content.history_visibility, {
			world_readable: "public",
			shared: "membersOnly",
			invited: "membersSinceInvited",
			joined: "membersSinceJoined"
		})
	});
};
