import { MUSTER_EVENTS } from "./event-constants.mjs"; import { AttendanceOutcomeValue } from "../domain/enums/attendance-outcome.enum.mjs"; import { CheckInMethodValue } from "../domain/enums/check-in-method.enum.mjs"; import { SessionStatusValue } from "../domain/enums/session-status.enum.mjs"; import { RecordTypeValue } from "../domain/enums/record-type.enum.mjs"; import { ProposedSessionChanges } from "../models/attendance-correction.model.mjs"; //#region src/events/event-payloads.d.ts /** * Wire form of `ProposedSessionChanges` — events serialize to JSON, so * `Date` fields travel as ISO-8601 strings (PACKAGE_RULES rule 25). * Subscribers wanting a `Date` call `new Date(changes.actualStart)`. */ interface ProposedSessionChangesWire { actualStart?: string; actualEnd?: string; checkInMethod?: CheckInMethodValue; checkOutMethod?: CheckInMethodValue; outcome?: AttendanceOutcomeValue; note?: string; metadata?: Record; } /** Serialize the in-process change set to its wire form. */ declare function toProposedChangesWire(changes: ProposedSessionChanges): ProposedSessionChangesWire; interface SessionEventCommon { sessionId: string; sessionNumber: string; organizationId: string; subjectRef: string; subjectModel: string; scope?: string; sessionKind?: string; } interface SessionOpenedPayload extends SessionEventCommon { actualStart: string; checkInMethod: CheckInMethodValue; scheduledStart?: string; scheduledEnd?: string; } interface SessionClosedPayload extends SessionEventCommon { actualStart: string; actualEnd: string; durationMs: number; breakMs: number; outcome?: AttendanceOutcomeValue; checkInMethod: CheckInMethodValue; checkOutMethod: CheckInMethodValue; } interface SessionCancelledPayload extends SessionEventCommon { cancelledAt: string; previousStatus: SessionStatusValue; reason: string; } interface SessionCorrectedPayload extends SessionEventCommon { correctionId: string; correctionNumber: string; appliedChanges: ProposedSessionChangesWire; appliedRecordId: string; } interface RecordAppendedPayload { recordId: string; sessionId: string; organizationId: string; subjectRef: string; subjectModel: string; recordType: RecordTypeValue; occurredAt: string; method?: CheckInMethodValue; /** Populated when `recordType === 'correction_applied'`. */ correctionOf?: string; correctionId?: string; } interface CorrectionEventCommon { correctionId: string; correctionNumber: string; sessionId: string; organizationId: string; subjectRef: string; subjectModel: string; } interface CorrectionRequestedPayload extends CorrectionEventCommon { requestedBy: string; requestedAt: string; proposedChanges: ProposedSessionChangesWire; reason: string; } interface CorrectionApprovedPayload extends CorrectionEventCommon { reviewedBy: string; reviewedAt: string; appliedChanges: ProposedSessionChangesWire; appliedRecordId: string; } interface CorrectionRejectedPayload extends CorrectionEventCommon { reviewedBy: string; reviewedAt: string; reviewerNote?: string; } type MusterEventPayloads = { [MUSTER_EVENTS.SESSION_OPENED]: SessionOpenedPayload; [MUSTER_EVENTS.SESSION_CLOSED]: SessionClosedPayload; [MUSTER_EVENTS.SESSION_CANCELLED]: SessionCancelledPayload; [MUSTER_EVENTS.SESSION_CORRECTED]: SessionCorrectedPayload; [MUSTER_EVENTS.RECORD_APPENDED]: RecordAppendedPayload; [MUSTER_EVENTS.CORRECTION_REQUESTED]: CorrectionRequestedPayload; [MUSTER_EVENTS.CORRECTION_APPROVED]: CorrectionApprovedPayload; [MUSTER_EVENTS.CORRECTION_REJECTED]: CorrectionRejectedPayload; }; //#endregion export { CorrectionApprovedPayload, CorrectionEventCommon, CorrectionRejectedPayload, CorrectionRequestedPayload, MusterEventPayloads, ProposedSessionChangesWire, RecordAppendedPayload, SessionCancelledPayload, SessionClosedPayload, SessionCorrectedPayload, SessionEventCommon, SessionOpenedPayload, toProposedChangesWire };