"use strict";
// Capability grant ↔ trust ladder bridge.
//
// When the user creates a capability grant, it's a strong signal of trust:
// promote the matching ladder rung once. When the user revokes a grant, it's
// a strong signal of distrust: demote the rung.
//
// Mapping is direct (capability id === ladder capability key) so callers
// don't need to translate.
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyGrantToLadder = applyGrantToLadder;
const trustLadder_1 = require("./trustLadder");
function applyGrantToLadder(snap, capability, action) {
    (0, trustLadder_1.ensureCapability)(snap, capability);
    // One grant action = one outcome; the ladder thresholds (5 for promote,
    // 2 for demote) determine when an actual rung change occurs.
    const outcome = action === 'create' ? 'accepted' : 'rejected';
    const result = (0, trustLadder_1.recordOutcome)(snap, capability, outcome);
    return {
        capability,
        rung: snap.capabilities[capability].rung,
        promoted: result.promoted,
        demoted: result.demoted,
    };
}
//# sourceMappingURL=grantBridge.js.map