export enum BookFormat {
  HARDCOVER = 'HARDCOVER',
  PAPERBACK = 'PAPERBACK',
  EBOOK = 'EBOOK',
  AUDIOBOOK = 'AUDIOBOOK',
}

export interface ICategory {
  id: string;
  name: string;
  slug: string;
  description?: string;
  parentId?: string;
  children?: ICategory[];
  createdAt: string;
  updatedAt: string;
}

export interface IAuthor {
  id: string;
  name: string;
  bio?: string;
  photoUrl?: string;
  createdAt: string;
  updatedAt: string;
}

export interface IPublisher {
  id: string;
  name: string;
  website?: string;
  contactEmail?: string;
  createdAt: string;
  updatedAt: string;
}

export interface IBook {
  id: string;
  title: string;
  isbn: string;
  slug: string;
  description: string;
  authorId: string;
  author?: IAuthor;
  publisherId?: string;
  publisher?: IPublisher;
  categoryId: string;
  category?: ICategory;
  language: string;
  format: BookFormat;
  price: number;
  discountPrice?: number;
  stockQuantity: number;
  coverImage?: string;
  pages?: number;
  publishedDate?: string;
  edition?: string;
  isFeatured: boolean;
  isActive: boolean;
  ratingAvg: number;
  ratingCount: number;
  createdAt: string;
  updatedAt: string;
}

export interface IBookFilterQuery {
  search?: string;
  categoryId?: string;
  categorySlug?: string;
  authorId?: string;
  language?: string;
  format?: BookFormat;
  minPrice?: number;
  maxPrice?: number;
  isFeatured?: boolean;
  sortBy?: 'price_asc' | 'price_desc' | 'rating' | 'newest' | 'title';
  page?: number;
  limit?: number;
}

export interface ICreateBookRequest {
  title: string;
  isbn: string;
  description: string;
  authorId: string;
  publisherId?: string;
  categoryId: string;
  language?: string;
  format: BookFormat;
  price: number;
  discountPrice?: number;
  stockQuantity: number;
  coverImage?: string;
  pages?: number;
  publishedDate?: string;
  edition?: string;
  isFeatured?: boolean;
}

export interface IUpdateBookRequest extends Partial<ICreateBookRequest> {
  isActive?: boolean;
}

export interface IReview {
  id: string;
  userId: string;
  userName?: string;
  bookId: string;
  rating: number;
  title?: string;
  comment?: string;
  createdAt: string;
  updatedAt: string;
}

export interface ICreateReviewRequest {
  bookId: string;
  rating: number;
  title?: string;
  comment?: string;
}
