import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
import { TFile } from "obsidian";
import { FileId } from "src/core";
import {
  ColorMap,
  PDFPageViewProps,
  Size,
  MimeType,
} from "./embeddedFileLoaderTypes";

export type SVGColorInfo = Map<
  string,
  {
    mappedTo: string;
    fill: boolean;
    stroke: boolean;
  }
>;

export type ScriptSettingValue = {
  value?: string | number | boolean;
  hidden?: boolean;
  description?: string;
  valueset?: string[];
  height?: number; //height of textarea in Plugin Settings if type is string
};

/**
 * Marker for UI helpers (e.g., suggesters) that, while active, should signal
 * host scripts to ignore or block their own keydown handlers.
 */
export interface KeyBlocker {
  isBlockingKeys(): boolean;
  close(): void;
}

export type ImageInfo = {
  mimeType: MimeType;
  id: FileId;
  dataURL: DataURL;
  created: number;
  isHyperLink?: boolean;
  hyperlink?: string;
  file?: string | TFile;
  hasSVGwithBitmap?: boolean;
  latex?: string;
  size?: Size;
  colorMap?: ColorMap;
  pdfPageViewProps?: PDFPageViewProps;
  renderScale?: number;
};

export interface AddImageOptions {
  topX: number;
  topY: number;
  imageFile: TFile | string;
  scale?: boolean;
  anchor?: boolean;
  colorMap?: ColorMap;
}
