local ____lualib = require("lualib_bundle")
local Map = ____lualib.Map
local __TS__New = ____lualib.__TS__New
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
local ____decorators = require("decorators")
local Exported = ____decorators.Exported
local ____ISCFeature = require("enums.ISCFeature")
local ISCFeature = ____ISCFeature.ISCFeature
local ____entities = require("functions.entities")
local getEntityID = ____entities.getEntityID
local ____pickupVariants = require("functions.pickupVariants")
local isCollectible = ____pickupVariants.isCollectible
local ____rooms = require("functions.rooms")
local getRoomItemPoolType = ____rooms.getRoomItemPoolType
local ____Feature = require("classes.private.Feature")
local Feature = ____Feature.Feature
local v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
____exports.CollectibleItemPoolType = __TS__Class()
local CollectibleItemPoolType = ____exports.CollectibleItemPoolType
CollectibleItemPoolType.name = "CollectibleItemPoolType"
__TS__ClassExtends(CollectibleItemPoolType, Feature)
function CollectibleItemPoolType.prototype.____constructor(self, pickupIndexCreation)
    Feature.prototype.____constructor(self)
    self.v = v
    self.postPickupInitCollectible = function(____, collectible)
        local pickupIndex = self.pickupIndexCreation:getPickupIndex(collectible)
        if not v.run.collectibleItemPoolTypeMap:has(pickupIndex) then
            local itemPool = game:GetItemPool()
            local lastItemPoolType = itemPool:GetLastPool()
            v.run.collectibleItemPoolTypeMap:set(pickupIndex, lastItemPoolType)
        end
    end
    self.featuresUsed = {ISCFeature.PICKUP_INDEX_CREATION}
    self.callbacksUsed = {{ModCallback.POST_PICKUP_INIT, self.postPickupInitCollectible, {PickupVariant.COLLECTIBLE}}}
    self.pickupIndexCreation = pickupIndexCreation
end
function CollectibleItemPoolType.prototype.getCollectibleItemPoolType(self, collectible)
    if not isCollectible(nil, collectible) then
        local entityID = getEntityID(nil, collectible)
        error("The \"getCollectibleItemPoolType\" function was given a non-collectible: " .. entityID)
    end
    local pickupIndex = self.pickupIndexCreation:getPickupIndex(collectible)
    local itemPoolType = v.run.collectibleItemPoolTypeMap:get(pickupIndex)
    return itemPoolType or getRoomItemPoolType(nil)
end
__TS__DecorateLegacy({Exported}, CollectibleItemPoolType.prototype, "getCollectibleItemPoolType", true)
return ____exports
