declare module '*.svg' {
  const content: string;
  export default content;
}

declare module 'pdfjs-dist';
declare module 'pdfjs-dist/build/pdf.worker.entry';
declare module 'query-string';
declare module 'react-toast-notifications';
declare module 'react-color';

type SelectOptionType = {
  key: string | number;
  content: React.ReactNode;
  child: React.ReactNode;
};

type RenderingStateType = 'RENDERING' | 'LOADING' | 'FINISHED' | 'PAUSED';

type LineType = 'Highlight' | 'Underline' | 'Squiggly' | 'StrikeOut';

type ReducerFuncType = (
  state: Record<string, any>,
  action: { type: string; payload: any }
) => any;

type ViewportType = {
  width: number;
  height: number;
};

type ProgressType = {
  loaded: number;
  total: number;
};

type ScrollStateType = {
  right: boolean;
  down: boolean;
  lastX: number;
  lastY: number;
  subscriber: any;
};

type PositionType = {
  top: number;
  bottom: number;
  left: number;
  right: number;
};

type HTMLCoordinateType = {
  top: number;
  left: number;
  width: number;
  height: number;
};

type PointType = {
  x: number;
  y: number;
};

type LinePositionType = {
  start: PointType;
  end: PointType;
};

type AnnotationPositionType =
  | string
  | PositionType
  | LinePositionType
  | PointType
  | (PositionType | PointType[])[];

type AnnotationAttributeType = {
  page: number;
  bdcolor?: string | undefined;
  position?: AnnotationPositionType;
  transparency?: number | undefined;
  content?: string | undefined;
  style?: number | undefined;
  fcolor?: string | undefined;
  ftransparency?: number | undefined;
  bdwidth?: number | undefined;
  fontname?: string | undefined;
  fontsize?: number | undefined;
  textcolor?: string | undefined;
  is_arrow?: boolean | undefined;
};

type AnnotationType = {
  id?: string;
  obj_type: string;
  obj_attr: AnnotationAttributeType;
};

type UpdateData = {
  bdcolor?: string;
  transparency?: number;
  position?: AnnotationPositionType;
  content?: string;
  fontsize?: number;
};

type OnUpdateType = (data: UpdateData) => void;

type DispatchType = {
  type: string;
  payload: string | number | boolean | Record<string, any> | any[];
};

type ActionType = (
  dispatch: (obj: DispatchType) => void
) => Record<string, any>;

type AnnotationElementPropsType = AnnotationType & {
  isCovered: boolean;
  isCollapse: boolean;
  mousePosition: Record<string, any>;
  onUpdate: OnUpdateType;
  onDelete: () => void;
  scale: number;
  viewport: ViewportType;
  onEdit: () => void;
  isEdit: boolean;
  onBlur: () => void;
};

type OptionPropsType = {
  type?: string;
  color?: string;
  opacity?: number;
  fontName?: string;
  fontSize?: number;
  width?: number;
  align?: string;
  fontStyle?: string;
  shape?: string;
  text?: string;
  setDataState?: (arg: Record<string, any>) => void;
};

type CoordType = {
  left: number;
  top: number;
  width?: number;
  height?: number;
};

type CircleType = {
  direction: string;
  cx: number;
  cy: number;
  r: number;
};

type WatermarkType = {
  type?: 'image' | 'text';
  scale?: number;
  opacity?: number;
  rotation?: number;
  pages?: string;
  vertalign?: 'top' | 'center' | 'bottom';
  horizalign?: 'left' | 'center' | 'right';
  xoffset?: number;
  yoffset?: number;
  imagepath?: string;
  text?: string;
  textcolor?: string;
  isfront?: 'yes' | 'no';
};
