import { SmrtCollection, SmrtObject } from '@happyvertical/smrt-core'; import { ServiceTargetStatus, ServiceTargetType, SupportEscalationReason } from '../types.js'; /** Outcome of one {@link SupportServiceTarget.checkAndEscalate} delivery. */ export interface CheckAndEscalateResult { outcome: 'breached' | 'escalated' | 'rescheduled' | 'noop' | 'missing'; } export declare class SupportServiceTarget extends SmrtObject { tenantId: string | null; caseId: string; targetType: ServiceTargetType; /** * Recurrence cycle for repeating clocks (`update` restarts after each * update). One-shot clocks stay at cycle 0. */ cycle: number; /** Severity key the minutes were derived from (audit). */ severity: string; /** Configured clock length in covered minutes. */ baseMinutes: number; /** When the clock started running. */ startedAt: Date; /** Current deadline, in wall-clock time (recomputed on pause/resume). */ dueAt: Date; status: ServiceTargetStatus; /** Set while the clock is paused (plan pause rules). */ pausedAt: Date | null; /** Accumulated paused time, excluded from the clock. */ pausedTotalSeconds: number; satisfiedAt: Date | null; breachedAt: Date | null; cancelledAt: Date | null; /** One-shot `_smrt_jobs` id scheduled for `dueAt` (cancel on satisfy). */ escalationJobId: string; metadata: string; getMetadata(): Record; setMetadata(value: Record): void; isRunning(): boolean; /** * One-shot escalation job entry point, delivered at-least-once by the * jobs runner at `dueAt` (and again for delayed policy steps). Reloads its * own persisted state first, so stale deliveries are harmless: * * - not `pending` and no due pending-escalation marker → no-op (already * satisfied/cancelled/paused, or an already-breached clock without a due * follow-up step); * - `pending` with `dueAt` in the future → no-op (the clock was * rescheduled after this job was enqueued); * - `pending` and overdue → mark breached and escalate through the plan's * escalation policy; * - `breached` with a due pending-escalation marker → continue with the * next policy step. * * The engine is imported dynamically to avoid a static model → service * cycle. `args.at` (ISO string or `Date`) pins "now" for deterministic * tests; the runner passes no args, so production uses wall-clock time. */ checkAndEscalate(args?: Record, _context?: unknown): Promise; } export declare class SupportServiceTargetCollection extends SmrtCollection { static readonly _itemClass: typeof SupportServiceTarget; forCase(caseId: string): Promise; /** Active clock of a type on a case (highest cycle wins). */ activeTarget(caseId: string, targetType: ServiceTargetType): Promise; } export declare class SupportEscalation extends SmrtObject { tenantId: string | null; caseId: string; /** Escalation level applied (1-based, follows the plan's policy steps). */ level: number; reason: SupportEscalationReason; /** Breached/at-risk target that triggered this, when applicable. */ targetId: string | null; targetType: string; /** Escalation action taken: `notify` | `reassign`. */ action: string; fromSpecialistId: string | null; toSpecialistId: string | null; /** Profiles notified (JSON array of profile ids). */ notifiedProfileIds: string; occurredAt: Date; note: string; getNotifiedProfileIds(): string[]; setNotifiedProfileIds(ids: string[]): void; } export declare class SupportEscalationCollection extends SmrtCollection { static readonly _itemClass: typeof SupportEscalation; forCase(caseId: string): Promise; } export default SupportServiceTarget; //# sourceMappingURL=support-service-target.d.ts.map