export interface BookListItem {
  id: number;
  title: string;
  author: string;
  genre: string;
  reading_status: string;
  reading_status_display: string;
  cover_image: string | null;
}

export interface BookDetail {
  id: number;
  title: string;
  author: string;
  genre: string;
  description: string;
  reading_status: string;
  reading_status_display: string;
  cover_image: string | null;
  total_pages: number;
  created_at: string;
  updated_at: string;
}

export interface EBookListItem {
  id: number;
  title: string;
  author: string;
  filename: string;
  format: string;
  page_count: number;
  cover_image: string | null;
  created_at: string;
  progress: number | null;
  started?: boolean;
}

export interface OpenLibraryMetadata {
  source?: string;
  match_status?: "matched" | "not_found" | string;
  match_score?: number;
  matched_at?: string;
}

export interface EBookDetail {
  id: number;
  title: string;
  author: string;
  filename: string;
  file_url: string;
  format: string;
  page_count: number;
  file_size: number;
  metadata?: OpenLibraryMetadata & Record<string, unknown>;
  cover_image: string | null;
  created_at: string;
  updated_at: string;
  progress: ReadingProgress | null;
}

export interface ReadingProgress {
  current_position: number;
  last_page: number;
  epub_location?: string;
}

export interface ReadingSettings {
  font_size: number;
  font_style: "sans-serif" | "serif" | "monospace";
  background_color: string;
}

export interface BookChapter {
  id: number;
  title: string;
  index: number;
  href: string;
  children: BookChapter[];
}

export interface TocResponse {
  chapters: BookChapter[];
  format: string;
  page_count: number;
}

export interface ContentResponse {
  page: number;
  total_pages: number;
  content: string;
  chapter_title: string;
  format: string;
}

export interface BookSearchParams {
  q?: string;
  genre?: string;
  author?: string;
  reading_status?: string;
  ordering?: string;
  page?: number;
  page_size?: number;
}

export const READING_STATUS_OPTIONS: { value: string; label: string }[] = [
  { value: "", label: "All Statuses" },
  { value: "want_to_read", label: "Want to Read" },
  { value: "reading", label: "Reading" },
  { value: "finished", label: "Finished" },
  { value: "dnf", label: "Did Not Finish" },
];