From f6444c31a5dc678b0964c9db56882c5c8a154792 Mon Sep 17 00:00:00 2001 From: itsrubberduck Date: Fri, 13 Feb 2026 14:20:26 +0100 Subject: [PATCH] feat(flightlab): add type definitions for FlightLab scenario engine Co-Authored-By: Claude Opus 4.6 --- shared/data/flightlab/types.ts | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 shared/data/flightlab/types.ts diff --git a/shared/data/flightlab/types.ts b/shared/data/flightlab/types.ts new file mode 100644 index 0000000..7947eae --- /dev/null +++ b/shared/data/flightlab/types.ts @@ -0,0 +1,63 @@ +// shared/data/flightlab/types.ts + +export interface FlightLabSound { + id: string + action: 'play' | 'stop' | 'crossfade' + volume?: number + loop?: boolean +} + +export interface FlightLabButton { + id: string + label: string + icon?: string + next: string + type?: 'primary' | 'comfort' | 'info' + instructorAlert?: string +} + +export interface FlightLabPhase { + id: string + atcMessage: string + explanation?: string + buttons: FlightLabButton[] + sounds?: FlightLabSound[] + instructorNote?: string + autoAdvanceAfterTTS?: boolean +} + +export interface FlightLabScenario { + id: string + title: string + description: string + icon: string + aircraft: string + airport: string + runway: string + callsign: string + phases: FlightLabPhase[] +} + +export type FlightLabRole = 'instructor' | 'participant' + +export interface FlightLabSessionState { + sessionCode: string + scenarioId: string + currentPhaseId: string + isPaused: boolean + startedAt: number + participantConnected: boolean + history: Array<{ + phaseId: string + buttonId: string + timestamp: number + }> +} + +export type FlightLabWSEvent = + | { type: 'state-change'; state: FlightLabSessionState } + | { type: 'instructor-message'; text: string; withRadioEffect: boolean } + | { type: 'instructor-command'; command: 'pause' | 'resume' | 'restart' | 'skip' | 'back'; targetPhaseId?: string } + | { type: 'participant-action'; buttonId: string; phaseId: string } + | { type: 'session-joined'; role: FlightLabRole } + | { type: 'error'; message: string }