import { GenericDocument } from './documents/GenericDocument';
import {
  BarcodeResultField,
  CheckStatus,
  HealthInsuranceCardDetectionStatus,
  HealthInsuranceCardField,
  LicenseStatus,
  MRZDocumentTypes,
  MedicalCertificateCheckboxesInfo,
  MedicalCertificateDatesInfo,
  MedicalCertificateFormType,
  MedicalCertificatePatientDataInfo,
  OCRPage,
  Page,
  PolygonPoint,
  RecognitionStatus,
  TextDataRecognitionResult,
} from './types';
import { DocumentDetectionStatus } from './document/DocumentDetectionStatus';
import { DocumentQuality } from './document/DocumentQuality';

export interface ApplyImageFiltersResult {
  /** The URI of the filtered image */
  imageFileUri: string;
}

export interface BarcodeScannerResult {
  /** The array of detected barcodes */
  barcodes?: BarcodeResultField[];
}

export interface BatchBarcodeScannerResult extends BarcodeScannerResult {}

export interface CheckRecognizerResult {
  /** Check Document represented as Generic Document */
  check: GenericDocument;
  /** The status of the operation */
  checkStatus: CheckStatus;
  /** The URI of the snapped Check Image */
  imageFileUri?: string;
}

export interface CreatePDFResult {
  /** The URI of the generated PDF file */
  pdfFileUri: string;
}

export interface CreateTIFFResult {
  /** The URI of the output TIFF file */
  tiffFileUri: string;
}

export interface CroppingResult {
  /** The cropped page */
  page: Page;
}

export interface DetectBarcodesOnImageResult {
  /** The detected barcodes */
  barcodes: BarcodeResultField[];
}

export interface DetectDocumentResult {
  /** The URI of the document image file, if something is detected */
  documentImageFileUri: string;
  /** The array of detected polygon points, if something is detected */
  polygon: PolygonPoint[];
  /** The status of the detection */
  detectionResult: DocumentDetectionStatus;
}

export interface DocumentExistsResult {
  /** true if the scanned document exists, false otherwise. */
  exists: boolean;
}

export interface DocumentQualityAnalyzerResult {
  /** Quality of the analyzed document */
  result: DocumentQuality;
}

export interface DocumentScannerResult {
  /** The array of scanned pages */
  pages: Page[];
}

/**
 * @deprecated
 */
export interface HealthInsuranceCardScannerResult {
  /** The array of recognized Health Insurance Card fields */
  fields: HealthInsuranceCardField[];
  /** Health Insurance Card detection status. */
  detectionStatus: HealthInsuranceCardDetectionStatus;
}

export interface ExtractImagesFromPdfResult {
  /** The URIs of the extracted images */
  imageFilesUrls: string[];
}

export interface ExtractPagesFromPdfResult {
  /** The extracted pages */
  pages: Page[];
}

export interface FinderDocumentScannerResult extends DocumentScannerResult {}

export interface GenericDocumentRecognizerResult {
  /** List of recognized Generic Documents */
  documents: GenericDocument[];
}

export interface GetImageDataResult {
  /** The Base 64 encoded representation of the image data */
  base64ImageData: string;
}

export interface GetLicenseInfoResult {
  /** True if the license is valid, false otherwise */
  isLicenseValid: boolean;
  /** The license status */
  licenseStatus: LicenseStatus;
  /** Detailed license status message for development and debug purposes */
  licenseStatusMessage?: string;
  /** The license expiration date in milliseconds */
  licenseExpirationDate?: number;
}

export interface GetOCRConfigsResult {
  /** The OCR languages data path */
  languageDataPath: string;
  /** The installed OCR languages */
  installedLanguages: string[];
}

export interface InitializeSDKResult {
  /** The result initialization message */
  result: string;
}

export interface LicensePlateScannerResult {
  /** The License Plate detected by the scanner */
  licensePlate: string;
  /** Confidence in result accuracy. The value ranges from 0 to 100, higher is better. */
  confidence: number;
  /** The Country Code on the License Plate as detected by the scanner */
  countryCode: string;
}

export interface MedicalCertificateScannerResult {
  /** The Medical Certificate Form Type */
  formType: MedicalCertificateFormType;
  /** Image file URI of the captured Medical Certificate */
  imageFileUri?: string;
  /** The extracted patient data */
  patientData: MedicalCertificatePatientDataInfo;
  /** The extracted dates data */
  dates: MedicalCertificateDatesInfo;
  /** The extracted checkboxes data. It contains information about the medical form checkboxes type and whether they are checked or not. */
  checkboxes: MedicalCertificateCheckboxesInfo;
}

export interface MrzScannerResult extends RecognizeMRZResult {}

export interface PerformOCRResult {
  /** The OCR result as plain text */
  plainText: string;
  /** The array of recognized OCR pages */
  pages: OCRPage[];
}

/**
 * @deprecated
 */
export interface RecognizeEHICResult extends HealthInsuranceCardScannerResult {}

export interface RecognizeGenericDocumentResult {
  /** Recognition status */
  recognitionStatus: RecognitionStatus;
  /** Cropped document image if it was detected */
  imageFileUri?: string;
  /** Contains a document which might be wrapped into one of ***DocumentsModelRootType*** */
  document?: GenericDocument;
}

export interface RecognizeMedicalCertificateResult extends MedicalCertificateScannerResult {}

export interface RecognizeMRZResult {
  /** True if the recognition was successful, false otherwise */
  recognitionSuccessful: boolean;
  /** The recognized document type */
  documentType: MRZDocumentTypes;
  /** Total number of check digits as required by the travel document type */
  checkDigitsCount: number;
  /** Number of successfully validated check digits. */
  validCheckDigitsCount: number;
  /** The raw string of the recognized machine readable zone. */
  rawString: string;
  /** MRZ Document represented as Generic Document */
  mrz?: GenericDocument;
}

export interface RefreshImageUrisResult {
  /** The refreshed pages */
  pages: Page[];
}

export interface RotateImageResult {
  /** The URI of the rotated image */
  imageFileUri: string;
}

export interface StoredDocumentIDsResult {
  /** The document identifiers of all stored documents. */
  documentIDs: string[];
}

export interface TextDataScannerResult {
  /** The Text Data Scanner recognition result */
  result: TextDataRecognitionResult;
}

export interface VinScannerResult {
  /** The scanned Vehicle Identification Number */
  rawText: string;
  /** The scanned result confidence value. */
  confidenceValue: number;
  /** Boolean that represents a successful validation */
  validationSuccessful: boolean;
}

export interface WriteTIFFResult {
  /** The URI of the output TIFF file */
  tiffFileUri: string;
}
