import { GenderEnum, ScraperSourceInput } from "src/core/generated-graphql";

export const STASH_BOX_PREFIX = "stashbox:";
export const SCRAPER_PREFIX = "scraper:";

export interface ITaggerSource {
  id: string;
  sourceInput: ScraperSourceInput;
  displayName: string;
  supportSceneQuery?: boolean;
  supportSceneFragment?: boolean;
}

export const DEFAULT_BLACKLIST = [
  "\\sXXX\\s",
  "1080p",
  "720p",
  "2160p",
  "KTR",
  "RARBG",
  "\\scom\\s",
  "\\[",
  "\\]",
];
export const DEFAULT_EXCLUDED_PERFORMER_FIELDS = ["name"];
export const DEFAULT_EXCLUDED_STUDIO_FIELDS = ["name"];
export const DEFAULT_EXCLUDED_TAG_FIELDS = ["name"];

export const initialConfig: ITaggerConfig = {
  blacklist: DEFAULT_BLACKLIST,
  mode: "auto",
  setCoverImage: true,
  setTags: true,
  tagOperation: "merge",
  fingerprintQueue: {},
  excludedPerformerFields: DEFAULT_EXCLUDED_PERFORMER_FIELDS,
  markSceneAsOrganizedOnSave: false,
  excludedStudioFields: DEFAULT_EXCLUDED_STUDIO_FIELDS,
  excludedTagFields: DEFAULT_EXCLUDED_TAG_FIELDS,
  createParentStudios: true,
  createParentTags: true,
};

export type ParseMode = "auto" | "filename" | "dir" | "path" | "metadata";
export type TagOperation = "merge" | "overwrite";
export interface ITaggerConfig {
  blacklist: string[];
  performerGenders?: GenderEnum[];
  mode: ParseMode;
  setCoverImage: boolean;
  setTags: boolean;
  tagOperation: TagOperation;
  selectedEndpoint?: string;
  fingerprintQueue: Record<string, string[]>;
  excludedPerformerFields?: string[];
  markSceneAsOrganizedOnSave?: boolean;
  excludedStudioFields?: string[];
  excludedTagFields?: string[];
  createParentStudios: boolean;
  createParentTags: boolean;
}

export const PERFORMER_FIELDS = [
  "name",
  "image",
  "disambiguation",
  "aliases",
  "gender",
  "birthdate",
  "death_date",
  "country",
  "ethnicity",
  "hair_color",
  "eye_color",
  "height",
  "weight",
  "penis_length",
  "circumcised",
  "measurements",
  "fake_tits",
  "tattoos",
  "piercings",
  "career_start",
  "career_end",
  "urls",
  "details",
];

export const STUDIO_FIELDS = ["name", "image", "url", "parent_studio"];
export const TAG_FIELDS = ["name", "description", "aliases", "parent_tags"];
