/** Core domain types for Cloud Reader */

export interface User {
  id: number;
  email: string;
  username: string;
}

export interface Book {
  id: string;
  title: string;
  author: string;
  total_pages: number;
  cover_image: string;
  created_at: string;
  updated_at: string;
}

export interface BookSummary {
  id: string;
  title: string;
  author: string;
  total_pages: number;
  cover_image: string;
}

export interface Bookmark {
  id: string;
  ebook: number;
  ebook_title: string;
  epub_cfi: string;
  chapter_index: number;
  chapter_title: string;
  page: number;
  location_text: string;
  content: string;
  highlight_color?: string;
  created_at: string;
  updated_at: string;
}

export interface Note {
  id: string;
  book: string;
  book_title: string;
  page: number;
  location_text: string;
  content: string;
  created_at: string;
  updated_at: string;
}

export interface CreateMarkerPayload {
  ebook: number;
  epub_cfi: string;
  chapter_index: number;
  chapter_title?: string;
  location_text?: string;
  content?: string;
  highlight_color?: string;
}

/** @deprecated Legacy note create */
export interface CreateNotePayload {
  book: string;
  page: number;
  location_text?: string;
  content: string;
}

export interface UpdateNotePayload {
  content: string;
}

export interface PaginatedResponse<T> {
  count: number;
  next: string | null;
  previous: string | null;
  results: T[];
}

export interface TokenResponse {
  access: string;
  refresh: string;
}

export interface MarkerEntry {
  id: string;
  ebook_id: number;
  ebook_title: string;
  epub_cfi: string;
  chapter_index: number;
  chapter_title: string;
  page: number;
  location_text: string;
  content: string;
  highlight_color?: string;
  created_at: string;
  updated_at: string;
}

export interface MarkersByBook {
  ebookId: number;
  ebookTitle: string;
  markers: MarkerEntry[];
}
