"use strict";

const addCommonFields = require("../event-add-common-fields");
const mapMaybeRedacted = require("../map-maybe-redacted");

// Not in spec, documentation at https://docs.google.com/document/d/1wCLXwUT3r4gVFuQpwWMHxl-nEf_Kx2pv34vZQQVb_Bc/edit#

module.exports = function mapRelatedGroupsEvent(event, _context) {
	return addCommonFields(event, {
		type: "associatedGroupsChanged",
		sender: event.sender,
		... mapMaybeRedacted(event, () => ({
			groups: event.content.groups
		}))
	});
};
