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

import type { CreateArtDto } from "./art.types";
import type { CreateBookDto } from "./book.types";
import type { CreateGameDto } from "./game.types";
import type { CreateMangaDto } from "./manga.types";
import type { CreateMusicDto } from "./music.types";
import type { CreateShowDto } from "./show.types";

enum SuggestionEntity {
  game = "GAME",
  book = "BOOK",
  music = "MUSIC",
  art = "ART",
  show = "SHOW",
  manga = "MANGA",
}

enum SuggestionStatus {
  unreviewed = "UNREVIEWED",
  accepted = "ACCEPTED",
  declined = "DECLINED",
}

interface SuggestionUser {
  id:        string;
  username:  string;
  avatar?:   string;
  inDiscord: boolean;
  isVip:     boolean;
  isMod:     boolean;
  isStaff:   boolean;
}

interface Suggestion {
  id:             string;
  userId:         string;
  user:           SuggestionUser;
  entityType:     SuggestionEntity;
  status:         SuggestionStatus;
  declineReason?: string;
  title:          string;
  gameData?:      Omit<CreateGameDto, "rating">;
  bookData?:      Omit<CreateBookDto, "rating">;
  musicData?:     Omit<CreateMusicDto, "rating">;
  artData?:       CreateArtDto;
  showData?:      Omit<CreateShowDto, "rating">;
  mangaData?:     Omit<CreateMangaDto, "rating">;
  createdAt:      Date;
  updatedAt:      Date;
}

interface CreateGameSuggestionDto {
  entityType:  SuggestionEntity.game;
  title:       string;
  platform?:   string;
  notes?:      string;
  coverImage?: string;
}

interface CreateBookSuggestionDto {
  entityType:  SuggestionEntity.book;
  title:       string;
  author:      string;
  isbn?:       string;
  notes?:      string;
  coverImage?: string;
}

interface CreateMusicSuggestionDto {
  entityType: SuggestionEntity.music;
  title:      string;
  artist:     string;
  type:       string;
  notes?:     string;
  coverArt?:  string;
}

interface CreateArtSuggestionDto {
  entityType:   SuggestionEntity.art;
  title:        string;
  artist:       string;
  description?: string;
  imageUrl:     string;
}

interface CreateShowSuggestionDto {
  entityType:  SuggestionEntity.show;
  title:       string;
  type:        string;
  notes?:      string;
  coverImage?: string;
}

interface CreateMangaSuggestionDto {
  entityType:  SuggestionEntity.manga;
  title:       string;
  author:      string;
  notes?:      string;
  coverImage?: string;
}

type CreateSuggestionDto =
  | CreateGameSuggestionDto
  | CreateBookSuggestionDto
  | CreateMusicSuggestionDto
  | CreateArtSuggestionDto
  | CreateShowSuggestionDto
  | CreateMangaSuggestionDto;

interface DeclineSuggestionDto {
  reason?: string;
}

interface AcceptWithEditsDto {
  title?:       string;
  platform?:    string;
  author?:      string;
  artist?:      string;
  isbn?:        string;
  type?:        string;
  notes?:       string;
  description?: string;
  coverImage?:  string;
  coverArt?:    string;
  imageUrl?:    string;
  tags?:        Array<string>;
  links?:       Array<{ label: string; url: string }>;
}

export { SuggestionEntity, SuggestionStatus };
export type {
  AcceptWithEditsDto,
  CreateArtSuggestionDto,
  CreateBookSuggestionDto,
  CreateGameSuggestionDto,
  CreateMangaSuggestionDto,
  CreateMusicSuggestionDto,
  CreateShowSuggestionDto,
  CreateSuggestionDto,
  DeclineSuggestionDto,
  Suggestion,
  SuggestionUser,
};
