-- Phase 4: Lesson sessions — individual lesson occurrences

CREATE TYPE "lesson_session_status" AS ENUM ('scheduled', 'attended', 'missed', 'makeup', 'cancelled');

CREATE TABLE "lesson_session" (
  "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  "enrollment_id" uuid NOT NULL REFERENCES "enrollment"("id"),
  "scheduled_date" date NOT NULL,
  "scheduled_time" time NOT NULL,
  "actual_start_time" time,
  "actual_end_time" time,
  "status" lesson_session_status NOT NULL DEFAULT 'scheduled',
  "instructor_notes" text,
  "member_notes" text,
  "homework_assigned" text,
  "next_lesson_goals" text,
  "topics_covered" text[],
  "makeup_for_session_id" uuid,
  "notes_completed_at" timestamptz,
  "created_at" timestamptz NOT NULL DEFAULT now(),
  "updated_at" timestamptz NOT NULL DEFAULT now()
);
