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 ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
local ____ISCFeature = require("enums.ISCFeature")
local ISCFeature = ____ISCFeature.ISCFeature
local ____Feature = require("classes.private.Feature")
local Feature = ____Feature.Feature
local v = {room = {
    pickupVariants = __TS__New(Map),
    pickupSubTypes = __TS__New(Map)
}}
____exports.PickupChangeDetection = __TS__Class()
local PickupChangeDetection = ____exports.PickupChangeDetection
PickupChangeDetection.name = "PickupChangeDetection"
__TS__ClassExtends(PickupChangeDetection, Feature)
function PickupChangeDetection.prototype.____constructor(self, postPickupChanged, pickupIndexCreation)
    Feature.prototype.____constructor(self)
    self.v = v
    self.postPickupUpdate = function(____, pickup)
        local pickupIndex = self.pickupIndexCreation:getPickupIndex(pickup)
        local oldVariant = v.room.pickupVariants:get(pickupIndex)
        v.room.pickupVariants:set(pickupIndex, pickup.Variant)
        local oldSubType = v.room.pickupSubTypes:get(pickupIndex)
        v.room.pickupSubTypes:set(pickupIndex, pickup.SubType)
        if oldVariant == nil or oldSubType == nil then
            return
        end
        if oldVariant ~= pickup.Variant or oldSubType ~= pickup.SubType then
            self.postPickupChanged:fire(
                pickup,
                oldVariant,
                oldSubType,
                pickup.Variant,
                pickup.SubType
            )
        end
    end
    self.featuresUsed = {ISCFeature.PICKUP_INDEX_CREATION}
    self.callbacksUsed = {{ModCallback.POST_PICKUP_UPDATE, self.postPickupUpdate}}
    self.postPickupChanged = postPickupChanged
    self.pickupIndexCreation = pickupIndexCreation
end
return ____exports
