"use strict";

// FIXME: Tombstones

const defaultValue = require("default-value");

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

module.exports = function mapRoomCreateEvent(event, _context) {
	// FIXME: Redactable
	return addCommonFields(event, {
		type: "roomCreated",
		sender: event.content.creator, // TODO: Verify that this is always equal to `event.sender`
		isFederated: defaultValue(event.content["m.federate"], true),
		roomVersion: event.content.room_version,
	});
};
