import { CreatePDFOptions, CreateTIFFOptions } from './arguments';
import { ParametricFilter } from './document/ParametricFilters';
import { Page } from './types';
import { Point } from './utils';

export interface CreateDocumentParams {
  /**
   * Image URIs that will be used to create the document. If empty or undefined, empty document will be created.
   */
  imageFileUris?: string[];
  /**
   * The maximum size of the document image.
   * Default is 0, no limit.
   */
  documentImageSizeLimit?: number;
  /**
   * The list of filters applied to the page.
   */
  filters?: ParametricFilter[];
  /**
   * Recognizes documents on created document.
   * Default is true.
   */
  documentDetection?: boolean;
}

export interface DocumentFromLegacyPagesParams {
  /**
   * Legacy pages.
   */
  pages: Page[];
  /**
   * The maximum size of the document image.
   * Default is 0, no limit.
   */
  documentImageSizeLimit?: number;
}

export interface PDFFromDocumentParams {
  /**
   * The ID of the document for which the PDF file will be created.
   */
  documentID: string;
  /**
   * Options for the PDF file that is created.
   */
  options?: CreatePDFOptions;
}

export interface TIFFFromDocumentParams {
  /**
   * The ID of the document for which the TIFF file will be created.
   */
  documentID: string;
  /**
   * Options for the TIFF file that is created.
   */
  options?: CreateTIFFOptions;
}

export interface AddPageParams {
  /**
   * Document ID to which this page will be added.
   */
  documentID: string;
  /**
   * Image URI that will be used to create a page.
   */
  imageFileUri: string;
  /**
   * The list of filters applied to the page.
   */
  filters?: ParametricFilter[];
  /**
   * Set preferred index at which new page should be added.
   */
  index?: number;
  /**
   * Recognizes documents on created document.
   * Default is true.
   */
  documentDetection?: boolean;
}

export interface MovePageParams {
  /**
   * Document ID in which this page exists.
   */
  documentID: string;
  /**
   * Current index of the page.
   */
  fromIndex: number;
  /**
   * Destination index.
   */
  toIndex: number;
}

export interface ModifyPageParams {
  /**
   * Document ID in which this page exists.
   */
  documentID: string;
  /**
   * Page by its ID that will be modified.
   */
  pageID: string;
  /**
   * The type of rotation to apply. If not specified, no rotation is applied.
   */
  rotation?: PageRotation;
  /**
   * The array of recognition polygon points to apply.
   */
  polygon?: Point[];
  /**
   * The list of filters to apply.
   */
  filters?: ParametricFilter[];
}

export interface RemovePageParams {
  /**
   * The ID of the document from which this page is to be removed.
   */
  documentID: string;
  /**
   * Page by its ID to be removed.
   */
  pageID: string;
}

/** Rotation of a page. */
export type PageRotation =
  /** A 90 degree clockwise rotation is applied to the page. */
  | 'CLOCKWISE_90'
  /** A 180 degree rotation is applied to the page. */
  | 'CLOCKWISE_180'
  /** A 90 degree counter-clockwise rotation is applied to the page. */
  | 'COUNTERCLOCKWISE_90';
