import { CompressFormat } from './customTypes';
import {
  BarcodeDocumentFormat,
  BarcodeFormat,
  EngineMode,
  Gs1HandlingMode,
  MSIPlesseyChecksumAlgorithm,
  AustraliaPostCustomerFormat,
} from './types';

interface InternalBarcodeDetectionCommonParameters {
  /**
   * Accepted barcode formats
   */
  barcodeFormats?: BarcodeFormat[];
  /**
   * An optional array of barcode document formats that act as a detection filter.
   * By default all supported document formats will be detected.
   */
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
  /**
   * Barcode scanner engine mode. Default is NEXT_GEN
   */
  engineMode?: EngineMode;
  /**
   * Optional minimum required text length of the detected barcode.
   * The default is 0 (setting is turned off).
   * NOTE: This feature works on ITF barcodes only.
   */
  minimumTextLength?: number;
  /**
   * Optional maximum required text length of the detected barcode.
   * The default is 0 (setting is turned off).
   * NOTE: This feature works on ITF barcodes only.
   */
  maximumTextLength?: number;
  /**
   * Optional minimum required quiet zone on the barcode.
   * Measured in modules (the size of minimal bar on the barcode).
   * The default is 10.
   * NOTE: This feature works on ITF barcodes only.
   */
  minimum1DBarcodesQuietZone?: number;
  /** The GS1 handling mode. The default value is PARSE. */
  gs1HandlingMode?: Gs1HandlingMode;
  /**
   * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
   * Has no effect if both single and double digit MSI Plessey checksums are enabled.
   * The default is `false`
   */
  stripCheckDigits?: boolean;
  /**
   * The checksum algorithm for MSI Plessey barcodes.
   * The default value is Mod10.
   */
  msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm;
  /**
   * If `true`, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. If `false` - mode is disabled. The default is `false`. Android only.
   * */
  lowPowerMode?: boolean;
  /**
   * If true, an additional quiet zone is added to the input image
   * The default is `false`.
   */
  addAdditionalQuietZone?: boolean;
  /**
   * The customer format used in AUSTRALIA_POST codes. Only relevant for format codes 59 and 62.
   * The default value is `ALPHA_NUMERIC`.
   */
  australiaPostCustomerFormat?: AustraliaPostCustomerFormat;
  /**
   * If `true`, the optional check digit for IATA_2_OF_5 codes is used in validation.
   * The default is `true`.
   */
  useIATA2OF5Checksum?: boolean;
  /**
   * If `true`, the optional check digit for CODE_11 codes is used in validation.
   * The default is `true`.
   */
  useCode11Checksum?: boolean;
}

export interface DetectBarcodesOnImageArguments extends InternalBarcodeDetectionCommonParameters {
  /**
   * The input image file URI
   */
  imageFileUri: string;
}

interface PdfExtractorArguments {
  /**
   * The location of the PDF file
   */
  pdfFilePath: string;
  /**
   * The quality that each extracted image should have.
   * This tweaks the compression, affecting the final image file size.
   * (100: maximum quality, 0: minimum quality)
   *
   * Default value is 90
   */
  quality?: number;
  /**
   * Integer scaling factor applied to the PDF media box frame while extracting.
   * Affects the output image quality.
   * In most cases the recommended value is 2 or higher.
   *
   * Default value is 2.
   */
  scaling?: number;
}

export interface ExtractImagesFromPdfArguments extends PdfExtractorArguments {
  /**
   * Compress format used for extracted images. Android only.
   *
   * Default value is JPEG.
   */
  compressFormat?: CompressFormat;
}
