/**
 * Security emitters — typed wrappers for SecurityEvent domain.
 */
import { createEventEnvelope } from '../events/envelope.js';
function securityEvent(type, data, ctx) {
    return createEventEnvelope(type, { type, ...data }, ctx);
}
export function emitTokenScopeViolation(bus, ctx, data) {
    bus.emit('security', securityEvent('TOKEN_SCOPE_VIOLATION', data, ctx));
}
export function emitTokenRotationWarning(bus, ctx, data) {
    bus.emit('security', securityEvent('TOKEN_ROTATION_WARNING', data, ctx));
}
export function emitTokenRotationExpired(bus, ctx, data) {
    bus.emit('security', securityEvent('TOKEN_ROTATION_EXPIRED', data, ctx));
}
export function emitTokenBlocked(bus, ctx, data) {
    bus.emit('security', securityEvent('TOKEN_BLOCKED', data, ctx));
}
// ── Auth audit emitters ────────────────────────────────────────────
/** Emit AUTH_SUCCEEDED when a user authenticates successfully. Never include credential values. */
export function emitAuthSucceeded(bus, ctx, data) {
    bus.emit('security', securityEvent('AUTH_SUCCEEDED', data, ctx));
}
/** Emit AUTH_FAILED when an authentication attempt fails. Never include credential values. */
export function emitAuthFailed(bus, ctx, data) {
    bus.emit('security', securityEvent('AUTH_FAILED', data, ctx));
}
// ── Companion pairing emitters ──────────────────────────────────
/** Emit COMPANION_PAIR_REQUESTED when a pairing request is initiated. */
export function emitCompanionPairRequested(bus, ctx, data) {
    bus.emit('security', securityEvent('COMPANION_PAIR_REQUESTED', data, ctx));
}
/** Emit COMPANION_PAIR_VERIFIED when a companion pairing is verified. */
export function emitCompanionPairVerified(bus, ctx, data) {
    bus.emit('security', securityEvent('COMPANION_PAIR_VERIFIED', data, ctx));
}
/** Emit COMPANION_TOKEN_ROTATED when a companion token is rotated. */
export function emitCompanionTokenRotated(bus, ctx, data) {
    bus.emit('security', securityEvent('COMPANION_TOKEN_ROTATED', data, ctx));
}
/** Emit COMPANION_TOKEN_REVOKED when a companion token is revoked. */
export function emitCompanionTokenRevoked(bus, ctx, data) {
    bus.emit('security', securityEvent('COMPANION_TOKEN_REVOKED', data, ctx));
}
