// Shapes returned by the backend's /api/info endpoint — shared between the
// Downloads screen's own URL entry and the in-app YouTube browser, since
// both end up showing the same "pick a quality/format" flow.

export interface FormatOption {
  formatId: string;
  type: "video" | "audio";
  label: string;
  ext: string;
  approxFileSize: string | null;
  height?: number;
  bitrateKbps?: number;
  /** Server-computed — true when this format's estimated size exceeds the server's configured max (see /api/config's maxMediaSizeBytes). Purely a UI hint: the actual enforcement is POST /api/download rejecting it server-side regardless of what the client does with this flag. */
  disabled?: boolean;
  disabledReason?: string | null;
}

export interface VideoMetadata {
  id: string;
  title: string;
  thumbnail: string;
  durationSeconds: number;
  uploader: string;
  webpageUrl: string;
  videoOptions: FormatOption[];
  audioOptions: FormatOption[];
}

export interface PlaylistVideo {
  id: string;
  title: string;
  thumbnail: string | null;
  durationSeconds: number | null;
  webpageUrl: string;
}

export interface PlaylistData {
  playlistTitle: string | null;
  videoCount: number;
  videos: PlaylistVideo[];
}
