export interface Course {
  id: number;
  name: string;
  short_name: string;
  category: string;
  description?: string | null;
  image_url?: string | null;
  created_at: Date;
  updated_at: Date;
  deleted?: number | boolean;
  prereq_id?: number | null;
  hasBookwork: boolean;
  hasQual: boolean;
}

export interface CourseEventDetails {
  id: number | null;              // PK
  course_id: number | null;       // FK → courses.id
  event_type: number | null;      // FK → event_types.id
  event_date: Date;             // datetime (not nullable)

  guilded_event_id: number | null;

  created_at: Date;             // datetime
  updated_at: Date;             // datetime

  deleted: boolean | null;        // tinyint(4), nullable
  report_url: string | null;      // varchar(2048)
  remarks: string | null;         // text

  attendees: CourseAttendee[] | null;

  created_by: number | null;
  created_by_name: string | null;
  course_name: string | null;
  course: Course | null;
}


export interface CourseAttendee {
  passed_bookwork: boolean;       // tinyint(1)
  passed_qual: boolean;           // tinyint(1)
  attendee_id: number;            // PK
  course_event_id: number;        // PK
  attendee_role_id: number | null;
  role: CourseAttendeeRole | null;
  created_at: Date;             // datetime → ISO string
  updated_at: Date;             // datetime → ISO string
  remarks: string | null;

  attendee_name: string | null;
}

export interface CourseAttendeeRole {
  id: number;                  // PK, auto-increment
  name: string | null;         // varchar(50), unique, nullable
  description: string | null;  // text
  created_at: Date | null;   // datetime (nullable)
  updated_at: Date | null;   // datetime (nullable)
  deleted: boolean;            // tinyint(4)
}

export interface RawAttendeeRow {
  passed_bookwork: number;       // tinyint(1)
  passed_qual: number;           // tinyint(1)
  attendee_id: number;
  course_event_id: number;
  attendee_role_id: number | null;
  created_at: string;
  updated_at: string;
  remarks: string | null;

  role_id: number | null;
  role_name: string | null;
  role_description: string | null;
  role_deleted: number | null;
  role_created_at: string | null;
  role_updated_at: string | null;

  attendee_name: string | null;
}

export interface CourseEventSummary {
  event_id: number;
  course_id: number;
  course_name: string;
  course_shortname: string;
  date: string;
  created_by: number;
  created_by_name: string;
}