import type { DeviceContext } from "./player";

export type VoteDirection = "up" | "down";

export type ClientEvent =
  | { type: "lecture_loaded"; lectureId: string }
  | { type: "segment_changed"; lectureId: string; segmentId: string; atSec: number }
  | {
      type: "slide_activated";
      lectureId: string;
      slideId: string;
      glitchSlideId: string;
      atSec: number;
    }
  | { type: "soft_pause_started"; lectureId: string; slideId: string; atSec: number }
  | { type: "soft_pause_ended"; lectureId: string; slideId: string; atSec: number }
  | {
      type: "full_pause_started";
      lectureId: string;
      slideId: string;
      glitchSlideId: string;
      atSec: number;
    }
  | {
      type: "glitch_slide_changed";
      lectureId: string;
      slideId: string;
      from: string;
      to: string;
      atSec: number;
    }
  | {
      type: "vote_committed";
      lectureId: string;
      slideId: string;
      selectedGlitchSlideId: string;
      previousGlitchSlideId: string;
      voteDirection?: VoteDirection;
      atSec: number;
    };

export interface VoteRequest {
  lectureId: string;
  slideId: string;
  previousGlitchSlideId: string;
  selectedGlitchSlideId: string;
  voteDirection?: VoteDirection;
  sessionId: string;
  timestamp: string;
  deviceContext: DeviceContext;
}
