local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
local ____roomShapeBounds = require("objects.roomShapeBounds")
local ROOM_SHAPE_BOUNDS = ____roomShapeBounds.ROOM_SHAPE_BOUNDS
local ____roomShapeCorners = require("objects.roomShapeCorners")
local ROOM_SHAPE_CORNERS = ____roomShapeCorners.ROOM_SHAPE_CORNERS
local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
local ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = ____roomShapeToBottomRightPosition.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
local ____roomShapeToGridWidth = require("objects.roomShapeToGridWidth")
local ROOM_SHAPE_TO_GRID_WIDTH = ____roomShapeToGridWidth.ROOM_SHAPE_TO_GRID_WIDTH
local ____roomShapeToTopLeftPosition = require("objects.roomShapeToTopLeftPosition")
local ROOM_SHAPE_TO_TOP_LEFT_POSITION = ____roomShapeToTopLeftPosition.ROOM_SHAPE_TO_TOP_LEFT_POSITION
local ____roomShapeVolumes = require("objects.roomShapeVolumes")
local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
local ____LRoomShapesSet = require("sets.LRoomShapesSet")
local L_ROOM_SHAPES_SET = ____LRoomShapesSet.L_ROOM_SHAPES_SET
local ____bigRoomShapesSet = require("sets.bigRoomShapesSet")
local BIG_ROOM_SHAPES_SET = ____bigRoomShapesSet.BIG_ROOM_SHAPES_SET
local ____narrowRoomShapesSet = require("sets.narrowRoomShapesSet")
local NARROW_ROOM_SHAPES_SET = ____narrowRoomShapesSet.NARROW_ROOM_SHAPES_SET
--- Helper function to see if a given room shape will grant a single charge or a double charge to the
-- player's active item(s).
-- 
-- For example, `RoomShape.SHAPE_2x2` will return true.
function ____exports.isRoomShapeDoubleCharge(self, roomShape)
    return roomShape >= RoomShape.SHAPE_2x2
end
--- Helper function to get the grid index delta that a door out of the given room shape would lead
-- to. For example, if you went through the bottom door in a room of `RoomShape.SHAPE_1x2`, you
-- would end up in a room with a grid index that is +26 units from the `SafeGridIndex` of where you
-- started.
function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
    local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
    return doorSlotToGridIndexMap:get(doorSlot)
end
--- Helper function to see if a given room shape will grant a single charge or a double charge to the
-- player's active item(s).
-- 
-- For example, `RoomShape.SHAPE_2x2` will return 2.
function ____exports.getRoomShapeBottomRightPosition(self, roomShape)
    return ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION[roomShape]
end
--- Helper function to get the grid position of the bottom-right tile of a given room shape.
-- 
-- "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
-- wall would be at "Vector(-1, -1)".)
function ____exports.getRoomShapeBounds(self, roomShape)
    return ROOM_SHAPE_BOUNDS[roomShape]
end
--- Helper function to get the number of charges that a given room shape will grant to a player upon
-- clearing it.
-- 
-- For example, `RoomShape.SHAPE_2x2` will return 2.
function ____exports.getRoomShapeCharges(self, roomShape)
    return ____exports.isRoomShapeDoubleCharge(nil, roomShape) and 2 or 1
end
--- Helper function to get the corners that exist in the given room shape.
-- 
-- Note that these corner locations are not accurate for the Mother Boss Room and the Home closet
-- rooms. (Those rooms have custom shapes.)
function ____exports.getRoomShapeCorners(self, roomShape)
    return ROOM_SHAPE_CORNERS[roomShape]
end
--- Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
-- room's actual contents! For that, use the `getRoomShapeBounds` function.
-- 
-- For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
function ____exports.getRoomShapeLayoutSize(self, roomShape)
    return ROOM_SHAPE_LAYOUT_SIZES[roomShape]
end
--- Helper function to get the grid position of the top-left tile of a given room shape.
-- 
-- "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
-- wall would be at "Vector(-1, -1)".)
function ____exports.getRoomShapeTopLeftPosition(self, roomShape)
    return ROOM_SHAPE_TO_TOP_LEFT_POSITION[roomShape]
end
--- Helper function to get the volume of a room shape, which is the amount of tiles that are inside
-- the room.
-- 
-- (This cannot be directly calculated from the bounds since L rooms are a special case.)
function ____exports.getRoomShapeVolume(self, roomShape)
    return ROOM_SHAPE_VOLUMES[roomShape]
end
function ____exports.getRoomShapeWidth(self, roomShape)
    return ROOM_SHAPE_TO_GRID_WIDTH[roomShape]
end
--- Helper function to determine if the provided room is equal to `RoomShape.1x2` (4) or
-- `RoomShape.2x1` (6).
function ____exports.is2x1RoomShape(self, roomShape)
    return roomShape == RoomShape.SHAPE_1x2 or roomShape == RoomShape.SHAPE_2x1
end
--- Helper function to detect if the provided room shape is big. Specifically, this is all 1x2 rooms,
-- 2x2 rooms, and L rooms.
function ____exports.isBigRoomShape(self, roomShape)
    return BIG_ROOM_SHAPES_SET:has(roomShape)
end
--- Helper function to determine if the provided room is equal to `RoomShape.LTL` (9),
-- `RoomShape.LTR` (10), `RoomShape.LBL` (11), or `RoomShape.LBR` (12).
function ____exports.isLRoomShape(self, roomShape)
    return L_ROOM_SHAPES_SET:has(roomShape)
end
--- Helper function to determine if the provided room is equal to `RoomShape.IH` (2), `RoomShape.IV`
-- (3), `RoomShape.IIV` (5), or `RoomShape.IIH` (7).
function ____exports.isNarrowRoom(self, roomShape)
    return NARROW_ROOM_SHAPES_SET:has(roomShape)
end
return ____exports
