/** * Calendar demo — the pure model: row and display types, the editor's * prefill / draft shapes, recurrence, the history ledger, the Backlog * queue, closures and availability shading, the print-sheet builder and * the free-slot search. No React, no i18n lookups (`closureReason` * takes the caller's `t`). Shared by the Final State (rail) demo and the * Increment 1 workspace, so both compute from one source. Every read of * practice data goes through the explicit `data: CalendarData` parameter * — the host supplies it, the model never reaches for a module global. */ import type { TFunction } from 'i18next'; import { type CalendarEvent, type CalendarEventStatus, type CalendarResource } from '../../components/calendar'; import type { WorkflowStatusTone } from '../../components/workflow-status'; import { APPOINTMENT_STATE_WORKFLOW } from '../../components/_shared/entity-card'; import { APPOINTMENT_STATUS_BADGE_VARIANT } from '../../components/appointment-details-panel/appointment-details-panel.identity'; import type { AppointmentRecurrenceFrequency } from '../../components/appointment-details-panel'; import type { CalendarData } from './calendar.data'; import { type CareDescriptionMode, type ColorAssociation, type CalendarBaseEvent, type CalendarBookingContact, type CalendarCareEntry, type CalendarCareLink, type CalendarClosure, type CalendarDayHours, type CalendarHistoryEntry, type CalendarPatient, type CalendarPhoneNumber, type CalendarSignDocument, type CalendarWaitingEntry, type CatalogueState, type PatientRef } from './calendar.types'; export declare const STATUS_UI_KEY: Record; export interface CalendarRow { event: CalendarEvent; chairId?: string; operatorId?: string; /** Set on every occurrence of a repeating series. */ series?: CalendarSeries; /** Care entries — the card's care line derives from these per cog mode. */ cares?: CalendarCareEntry[]; /** Free-text description (platform `name`); fixtures carry none. */ description?: string; /** Where the cares came from — a care plan's lines or a price list. */ careLink?: CalendarCareLink; } /** * A drag/resize of a PATIENT appointment awaiting confirmation (the * retired appointment-workflow pattern's move-confirm design). Rows stay * UN-mutated while the dialog is open, so the OLD end/chair/operator are * read live from the matching `CalendarRow`; `event` is FullCalendar's * post-drop snapshot and already carries the NEW resourceId. */ export interface PendingMove { event: CalendarEvent; kind: 'drop' | 'resize'; oldStart: Date; newStart: Date; oldEnd?: Date; /** Post-drop end, snapshotted so a re-commit cannot re-apply the delta. */ newEnd?: Date; /** Post-drop column. `event.resourceId` still reports the OLD one. */ newResourceId?: string; revert?: () => void; } export declare function movesSilently(event: CalendarEvent): boolean; /** The reference for one patient id — the record when the host could * answer, and always the id itself. */ export declare function patientRefById(id: string | number | null | undefined, data: CalendarData): PatientRef; /** The reference for the patient an appointment carries. */ export declare function eventPatientRef(event: CalendarEvent, data: CalendarData): PatientRef; export declare function isPendingBooking(event: CalendarEvent): boolean; export declare function selectPendingBookings(rows: CalendarRow[]): CalendarRow[]; /** * What a grid click focused in the rail. A FRESH object per click (not a * bare id) so re-clicking the same event re-docks its panel after the user * collapsed the rail — the registrar's effect keys on the object identity. */ export type RailFocus = { kind: 'appointment'; eventId: string; } | { kind: 'task'; eventId: string; } | null; /** * The RANGE views of the standard calendar experience — a dedicated * segmented split button in the header (Day · 3 days · Working week · * Week · Month). The chair/operator axis and the columns/timeline * orientation are NOT views: they are per-user display settings and live * in the cog. Month has no resource variant (platform parity) — it is * always the plain calendar. */ export type ViewOptionId = 'day' | 'threeDays' | 'workingWeek' | 'week' | 'month'; export interface ViewOption { id: ViewOptionId; /** CalendarView stem — composed with the cog's group-by axis. */ stem: 'Day' | 'ThreeDays' | 'Week' | 'Month'; /** Working week trims the weekend regardless of the Sundays setting. */ workingWeek?: boolean; } export declare const VIEW_OPTIONS: ViewOption[]; /** * On-the-fly DISPLAY settings — the platform buries these per-user knobs in * Settings; the sketch surfaces them in a header cog so users adjust the * view without leaving the agenda. The view knobs are display-only and * instantly reversible. The cog also carries the two per-user data-entry * defaults (care description, colour association): they govern what NEW or * MOVED appointments get, never what is already painted. Default duration * and the business hours themselves stay in Settings. */ export interface DisplaySettings { /** Which resource axis the columns/rows group by. */ resourceKind: 'chair' | 'operator' | 'none'; /** Vertical resource columns vs the horizontal timeline. */ orientation: 'vertical' | 'horizontal'; zebraRows: boolean; showTime: boolean; /** Optional for saved preferences and older consumers. @default 'compact' */ slotDensity?: 'compact' | 'comfortable'; /** Picker colour strength. @default 'tinted' */ eventColorStyle?: 'solid' | 'tinted'; /** Show the opposite resource on tall cards. @default false */ showCardContext?: boolean; slotDuration: '00:15' | '00:30' | '01:00'; window: 'working' | 'extended' | 'full'; /** How the card describes its cares (platform care visualization). */ careDescription: CareDescriptionMode; /** Which colour a new or moved appointment inherits. */ colorAssociation: ColorAssociation; } export declare const DEFAULT_DISPLAY: DisplaySettings; /** A remembered range view, only while the segment still exists. */ export declare function readViewOptionId(raw: unknown): ViewOptionId | undefined; export declare const DISPLAY_READERS: { [K in keyof DisplaySettings]-?: (raw: unknown) => DisplaySettings[K] | undefined; }; export declare function readDisplayField(target: DisplaySettings, field: K, raw: unknown): void; /** * Remembered display settings, validated PER FIELD over the defaults — * a stale shape from an earlier session keeps every knob it still knows * and never wipes the newer ones. Anything but an object is rejected. */ export declare function readDisplaySettings(raw: unknown): DisplaySettings | undefined; /** Remembered chair / operator selections, kept to the practice's ids. */ export declare function readChairIds(data: CalendarData): (raw: unknown) => string[] | undefined; export declare function readOperatorIds(data: CalendarData): (raw: unknown) => string[] | undefined; /** Tri-state for a select-all row over `ids`. */ export declare function selectionState(selected: readonly string[], ids: readonly string[]): boolean | 'indeterminate'; /** Time-only Intl options for the peek's semantic `