import { Types } from "mongoose"; export interface QueueDepthsType { incident: number; status: number; vehicle: number; total: number; } export interface TCSendHealthType { lastSuccessfulIncidentSend?: Date; lastSuccessfulUnitStatusSend?: Date; sendFailuresDelta: number; lastSendError: string; } export interface WriteBackHealthType { attemptsDelta: number; failuresDelta: number; lastSuccessfulWriteBack?: Date; lastError: string; } export interface SyncHealthType { lastCacheRefresh?: Date; cacheAgeSeconds: number; consecutiveEmptyPolls: number; lastPollChanges: number; incidentCacheGrowthDelta: number; } export interface StatusBeaconType { _id: Types.ObjectId; departmentId: string; // Identity integration: string; interfaceStartTime: Date; // UTC time the integration service process started; never resets — use for uptime keepAliveIntervalSecs: number; // this box's beacon cadence; "beacon missing" = no beacon for 2x this + 15s // Health State healthState: string; triggerReason: string; consecutiveFailures: number; consecutiveSuccesses: number; totalFailuresSinceLastHealthy: number; outageStartTime?: Date; // UTC time the current outage began; absent when healthy // Cycle Metrics pollCycle: number; lastPollMs: number; activeIncidents: number; activeUnits: number; // Data Flow Deltas incidentsDelta: number; unitStatusDelta: number; // Queue Depths queueDepths: QueueDepthsType; queueAges: Record; // oldest message age per relay queue (beacon 1.2+) queueDroppedDelta: number; // messages dropped after max retries since the last beacon // Auth Token Health (Bearer auth only; null otherwise) tokenAgeSecs?: number; tokenExpiresAt?: Date; // TC Send Health tCSend: TCSendHealthType; // Write-back Health writeBack: WriteBackHealthType; // Sync Health sync: SyncHealthType; // Diagnostics (beacon 1.2+) — free-form while the wire dialect settles; display only channels: Record; // per target (incident, vehicleStatus, avl, ...): armed, lastSuccessUtc, ageSecs, ... pollers: Record; // TC → CAD write-back pollers (status, event, avl) auth: Record; // per-message key failures restartPoll: Record; clockSync: Record; // Debug & Config debugPushActive: boolean; lastConfigSave?: Date; lastConfigSaveFile: string; // Error & Version lastError: string; interfaceVersion: string; cadVersion: string; unifiedVersion: string; beaconVersion: string; // beacon payload dialect, e.g. "1.2.22" // System (managed by Mongoose timestamps) createdAt: Date; updatedAt: Date; } export interface StatusBeaconTransitionType { _id: Types.ObjectId; departmentId: string; integration: string; triggerReason: string; healthState: string; consecutiveFailures: number; totalFailuresSinceLastHealthy: number; lastError: string; // System (managed by Mongoose timestamps) createdAt: Date; updatedAt: Date; }