export interface MediaStreamSummary {
  codecType: "video" | "audio" | "other";
  codecName: string | null;
  width: number | null;
  height: number | null;
  frameRate: number | null;
  durationSeconds: number | null;
  channels: number | null;
  sampleRate: number | null;
}

export interface VideoMetadata {
  filename: string;
  durationSeconds: number;
  width: number;
  height: number;
  frameRate: number | null;
  hasAudio: boolean;
  videoCodec: string | null;
  audioCodec: string | null;
  streams: MediaStreamSummary[];
}

export type FrameOutputFormat = "png" | "jpg";
export type AudioOutputFormat = "mp3" | "wav" | "m4a";
export type VideoOutputFormat = "mp4" | "mov" | "webm" | "mkv" | "avi";
export type ConversionQualityPreset = "high" | "standard" | "small";

export interface ThumbnailEnhancementOptions {
  sharpen?: boolean;
  boost?: boolean;
  titleSafeOverlay?: boolean;
}

export interface StoredUploadFile {
  tempPath: string;
  originalName: string;
  safeBaseName: string;
  extension: string;
  sizeBytes: number;
}

export interface FrameExtractionResult {
  outputPath: string;
  format: FrameOutputFormat;
  timestampSeconds: number;
}

export interface AudioExtractionResult {
  outputPath: string;
  format: AudioOutputFormat;
  startSeconds: number | null;
  endSeconds: number | null;
}

export interface FormatConversionResult {
  outputPath: string;
  format: VideoOutputFormat;
  preset: ConversionQualityPreset;
}

export interface ThumbnailCandidate {
  id: string;
  timestampSeconds: number;
  outputPath: string;
  score: number;
  rationale: string;
}

export interface InstagramVideoInfo {
  sourceUrl: string;
  webpageUrl: string;
  title: string;
  uploader: string | null;
  uploaderHandle: string | null;
  uploaderProfileImageUrl: string | null;
  durationSeconds: number | null;
  width: number | null;
  height: number | null;
  thumbnailUrl: string | null;
  extractorKey: string | null;
}

export interface InstagramDownloadResult {
  outputPath: string;
  fileName: string;
  info: InstagramVideoInfo;
}

export interface TwitterVideoInfo {
  sourceUrl: string;
  webpageUrl: string;
  title: string;
  uploader: string | null;
  uploaderHandle: string | null;
  uploaderProfileUrl: string | null;
  uploaderProfileImageUrl: string | null;
  durationSeconds: number | null;
  width: number | null;
  height: number | null;
  thumbnailUrl: string | null;
  extractorKey: string | null;
}

export interface TwitterDownloadResult {
  outputPath: string;
  fileName: string;
  info: TwitterVideoInfo;
}

export interface YouTubeVideoInfo {
  sourceUrl: string;
  webpageUrl: string;
  title: string;
  uploader: string | null;
  uploaderHandle: string | null;
  uploaderProfileUrl: string | null;
  uploaderProfileImageUrl: string | null;
  durationSeconds: number | null;
  width: number | null;
  height: number | null;
  thumbnailUrl: string | null;
  extractorKey: string | null;
}

export interface YouTubeDownloadResult {
  outputPath: string;
  fileName: string;
  info: YouTubeVideoInfo;
}

export interface TikTokVideoInfo {
  sourceUrl: string;
  webpageUrl: string;
  title: string;
  uploader: string | null;
  uploaderHandle: string | null;
  uploaderProfileUrl: string | null;
  uploaderProfileImageUrl: string | null;
  durationSeconds: number | null;
  width: number | null;
  height: number | null;
  thumbnailUrl: string | null;
  extractorKey: string | null;
}

export interface TikTokDownloadResult {
  outputPath: string;
  fileName: string;
  info: TikTokVideoInfo;
}
