local dnf = require("dnf")
assert(dnf.api_version == "dnf/v1", "requires dnf/v1")
assert(dnf.hooks.catalog()["dungeon.admission"], "dungeon admission Hook is unavailable")

local blocked = dnf.config.blocked_dungeon_ids or {}
assert(type(blocked) == "table", "blocked_dungeon_ids must be a string-key set")
for id, enabled in pairs(blocked) do
    assert(type(id) == "string" and string.match(id, "^%d+$")
        and type(enabled) == "boolean", "use decimal string keys and boolean values")
end

dnf.hooks.before("dungeon.admission", function(ctx, plan, event)
    -- Bare context; one decision for the prepared party, not once per member.
    local key = string.format("%.0f", event.dungeon_id)
    return blocked[key] ~= true
end)
