/**
 * @copyright NHCarrigan
 * @license Naomi's Public License
 * @author Naomi Carrigan
 */

import type { Link } from "./common.types";

enum BookStatus {
  reading = "READING",
  finished = "FINISHED",
  toRead = "TO_READ",
  retired = "RETIRED",
}

interface Book {
  id:            string;
  title:         string;
  author:        string;
  isbn?:         string;
  status:        BookStatus;
  dateAdded:     Date;
  dateStarted?:  Date;
  dateFinished?: Date;
  rating?:       number;
  notes?:        string;
  coverImage?:   string;
  tags:          Array<string>;
  links:         Array<Link>;
  series?:       string;
  seriesOrder?:  number;
  timeSpent?:    number;
  createdAt:     Date;
  updatedAt:     Date;
}

interface CreateBookDto {
  title:         string;
  author:        string;
  isbn?:         string;
  status:        BookStatus;
  dateStarted?:  Date;
  dateFinished?: Date;
  rating?:       number;
  notes?:        string;
  coverImage?:   string;
  tags?:         Array<string>;
  links?:        Array<Link>;
  series?:       string;
  seriesOrder?:  number;
  timeSpent?:    number;
}

interface UpdateBookDto extends Partial<CreateBookDto> {
  dateStarted?:  Date;
  dateFinished?: Date;
}

export { type Book, BookStatus, type CreateBookDto, type UpdateBookDto };
