import { AttendanceOutcomeValue } from "../domain/enums/attendance-outcome.enum.mjs"; import { CheckInMethodValue } from "../domain/enums/check-in-method.enum.mjs"; import { CorrectionStatusValue } from "../domain/enums/correction-status.enum.mjs"; import { Document, Schema, Types } from "mongoose"; import { ApprovalChain } from "@classytic/primitives/approval"; //#region src/models/attendance-correction.model.d.ts interface ProposedSessionChanges { actualStart?: Date; actualEnd?: Date; checkInMethod?: CheckInMethodValue; checkOutMethod?: CheckInMethodValue; outcome?: AttendanceOutcomeValue; note?: string; /** * Partial metadata patch merged on top of the session's existing metadata * at approval time (`$set: { metadata: { ...existing, ...changes.metadata } }`). * Use to clear or update audit breadcrumbs like `geofenceViolation`. * `undefined` leaves existing metadata untouched. */ metadata?: Record; } interface AttendanceCorrectionDocument extends Document { _id: Types.ObjectId; /** Human-readable id via customIdPlugin: COR-2026-0001 */ correctionNumber: string; organizationId: Types.ObjectId | string; sessionId: Types.ObjectId; subjectRef: string; subjectModel: string; status: CorrectionStatusValue; proposedChanges: ProposedSessionChanges; reason: string; /** * Optional multi-step approval chain from `@classytic/primitives/approval`. * When set, `approve()` is gated on `isApproved(chain)` — same pattern as * `@classytic/order`'s `Quotation.approvals`. Simple single-reviewer * corrections leave this undefined. */ approvals?: ApprovalChain; requestedBy: string; requestedAt: Date; reviewedBy?: string; reviewedAt?: Date; /** Reviewer comment on approve / reject. */ reviewerNote?: string; /** Set on approval to the record id that was emitted. */ appliedRecordId?: Types.ObjectId; metadata?: Record; deletedAt?: Date | null; createdAt: Date; updatedAt: Date; version: number; } //#endregion export { AttendanceCorrectionDocument, ProposedSessionChanges };