/**
 * Team-Health-Watchdog (THW) — Shared Types (Layer 4 Liveness Aggregator)
 *
 * Per the SEALED design at `.crewly/knowledge/team-health-watchdog-design-2026-04-25.md`,
 * these types are the contract surface between the pure detector, alert
 * router, watchdog service, and the orchestrator skill.
 *
 * Verdict tier names (§17 Q1, SEALED 2026-04-25T15:25Z):
 *   code:    'healthy' | 'stalling' | 'stuck' | 'cascade' | 'stale'
 *   display: 🟢       | 🟡         | 🔴      | 🚨        | 🟪
 *
 * Layer-4 invariant (§A.1, SEALED): THW READS, NEVER WRITES lower-layer
 * state.
 *
 * @module services/team-health/team-health-types
 */
export const VERDICT_CODES = [
    'healthy',
    'stalling',
    'stuck',
    'cascade',
    'stale',
];
/**
 * Single source of truth for code → emoji rendering.
 */
export const VERDICT_DISPLAY = {
    healthy: '🟢',
    stalling: '🟡',
    stuck: '🔴',
    cascade: '🚨',
    stale: '🟪',
};
/**
 * Severity ordering for verdict tiers — used to merge multiple gates'
 * verdicts into one. Higher number = more severe.
 */
export const VERDICT_SEVERITY = {
    healthy: 0,
    stalling: 1,
    stale: 2,
    stuck: 3,
    cascade: 4,
};
/** SEALED default thresholds (§17 Q2). */
export const DEFAULT_THRESHOLDS = {
    TEAM_IDLE_T1_MS: 30 * 60 * 1000,
    PENDING_T1_MS: 30 * 60 * 1000,
    TRIGGER_SILENCE_T1_MS: 60 * 60 * 1000,
    STUCK_T2_MS: 60 * 60 * 1000,
    ORPHAN_REQUEST_T1_MS: 15 * 60 * 1000,
};
export const DEFAULT_ALERTING = {
    yellowCooldownMs: 60 * 60 * 1000,
    redCooldownMs: 30 * 60 * 1000,
    cascadeCooldownMs: 15 * 60 * 1000,
    alertBudgetWindowMs: 6 * 60 * 60 * 1000,
    alertBudgetMaxAlertsPerTeam: 3,
};
export const DEFAULT_STALE_TRIGGER = {
    enabled: true,
    minPriorDoneCountForRedundancy: 3,
};
export const DEFAULT_LOST_DISPATCH = {
    enabled: true,
    T1Ms: 10 * 60 * 1000,
    postRestartGraceMs: 60_000,
};
export const DEFAULT_CONFIG = {
    enabled: true,
    shadowMode: true,
    sweepIntervalMs: 60_000,
    bootGraceMs: 5 * 60 * 1000,
    thresholds: { ...DEFAULT_THRESHOLDS },
    byTeam: {},
    alerting: { ...DEFAULT_ALERTING },
    offHoursSuppression: {
        enabled: true,
        ownerTimezone: 'America/New_York',
        workingHours: '09:00-21:00',
    },
    staleTriggerDetection: { ...DEFAULT_STALE_TRIGGER },
    lostDispatchDetection: { ...DEFAULT_LOST_DISPATCH },
};
// ---------------------------------------------------------------------------
// Type Guards / Helpers
// ---------------------------------------------------------------------------
export function isValidVerdictCode(value) {
    return VERDICT_CODES.includes(value);
}
export function maxVerdict(a, b) {
    return VERDICT_SEVERITY[b] > VERDICT_SEVERITY[a] ? b : a;
}
//# sourceMappingURL=team-health-types.js.map