import { ZoomWebinarStatus } from '../enum/zoom-webinar-status.enum';
import { SessionProviderType } from '../enum/session-provider.enum';

export interface MeetingDetails {
  /** Which provider backs this session. Persisted so update/delete can re-resolve. */
  provider?: SessionProviderType;
  meetingLink: string;
  meetingId: string;
  meetingPassword: string;
  // ---- Zoom operational fields (mirror WebinarDetails so meetings flow through
  // the same lifecycle/webhook/tracking pipeline as webinars) ----
  /** Per-user registration URL, present only when the meeting requires registration. */
  registrationLink?: string;
  /**
   * Whether attendees join via per-user registrants (true) or a single shared
   * join link + passcode (false). Drives the registration flow.
   */
  requireRegistration?: boolean;
  /** Host email under which the Zoom meeting was created. */
  hostEmail?: string;
  /** Host start URL — sensitive, never expose to attendee-facing responses. */
  startUrl?: string;
  /** Lifecycle status of the meeting. */
  status?: ZoomWebinarStatus;
  /** Actual end time reported by the `meeting.ended` webhook (ISO 8601); `null` until it fires. */
  actualMeetingEndsAt?: string | null;
  /** Minutes before start the host/admin can start the session (store-only; FE gates). */
  hostStartOpensMinutesBefore?: number;
}

export interface WebinarDetails {
  /** Which provider backs this session. Persisted so update/delete can re-resolve. */
  provider?: SessionProviderType;
  webinarLink: string;
  webinarId: string;
  webinarPassword: string;
  panelistLink: string;
  registrationLink: string;
  // ---- Zoom operational fields (consolidated from the standalone module) ----
  /** Host email under which the Zoom webinar was created. */
  hostEmail?: string;
  /** Host start URL — sensitive, never expose to attendee-facing responses. */
  startUrl?: string;
  /** Lifecycle status of the webinar. */
  status?: ZoomWebinarStatus;
  /** Actual end time reported by the `webinar.ended` webhook (ISO 8601); `null` until it fires. */
  actualMeetingEndsAt?: string | null;
  /** Minutes before start the host/admin can start the session (store-only; FE gates). */
  hostStartOpensMinutesBefore?: number;
  maxVideoLimit?: number;
  maxNonVideoLimit?: number;
  videoLimitCount?: number;
  nonVideoLimitCount?: number;
}

export interface StreamDetails {
  streamUrl: string;
  backupStreamUrl?: string;
  chatUrl?: string;
}

/**
 * Bridges the legacy detail shapes (still used by DTOs and provider responses)
 * and the normalized `hdb_online_session` row — the input to the online-session
 * mapper.
 */
export interface OnlineDetailsInput {
  meetingDetails?: MeetingDetails | null;
  webinarDetails?: WebinarDetails | null;
  streamDetails?: StreamDetails | null;
}
