import {
  Stage,
  Document,
  CaptureMode,
  FileFormat,
  Resolution,
  CountryCodes,
  Error,
} from './enums';

export interface DocumentDetectorCapture {
  imagePath: string;
  imageUrl: string;
  label: string;
  quality: number;
}

export interface DocumentDetectorResult {
  captures: DocumentDetectorCapture[];
  trackingId: string;
  type: string;
}

export interface DocumentDetectorError {
  statusCode: string;
  message: string;
  error: Error;
}

export interface DocumentDetectorResponse {
  result: DocumentDetectorResult | null;
  error: DocumentDetectorError | null;
  cancelled: boolean;
}

export interface DocumentDetectorStep {
  document: Document;
  stepLabel?: string;
  showStepLabel?: boolean;
  illustration?: string;
}

export interface DocumentDetectorCaptureStage {
  captureMode: CaptureMode;
  durationMillis?: number | null;
  wantSensorCheck: boolean;
}

export interface DocumentDetectorUploadSettings {
  enable?: boolean;
  compress?: boolean;
  fileFormats?: FileFormat[];
  maxFileSize?: number;
}

export interface DocumentDetectorMessageSettings {
  waitMessage?: string;
  fitTheDocumentMessage?: string;
  holdItMessage?: string;
  verifyingQualityMessage?: string;
  lowQualityDocumentMessage?: string;
  uploadingImageMessage?: string;
  popupDocumentSubtitleMessage?: string;
  unsupportedDocumentMessage?: string;
  wrongDocumentMessage?: string;
  documentNotFoundMessage?: string;
  sensorLuminosityMessage?: string;
  sensorOrientationMessage?: string;
  sensorStabilityMessage?: string;
  positiveButtonMessage?: string;
  predictorScanDocumentMessage?: string;
  predictorGetCloserMessage?: string;
  predictorCentralizeMessage?: string;
  predictorMoveAwayMessage?: string;
  predictorAlignDocumentMessage?: string;
  predictorTurnDocumentMessage?: string;
  predictorCapturedMessage?: string;
}

export interface DocumentFeedbackColors {
  defaultColor?: string;
  errorColor?: string;
  successColor?: string;
}

export interface DocumentDetectorStyle {
  primaryColor?: string;
  feedbackColors?: DocumentFeedbackColors;
  secondaryColor?: string;
  backgroundColor?: string;
  contentColor?: string;
  mediumColor?: string;
}

export interface DocumentDetectorSensorSettingsStabilitySensor {
  stabledMillis: number;
  threshold: number;
}

export interface DocumentDetectorSensorSettings {
  luminositySensor?: number;
  orientationSensor?: number;
  stabilitySensor?: DocumentDetectorSensorSettingsStabilitySensor;
}

export interface DocumentDetectorProxySettingsAuthentication {
  user: string;
  password: string;
}

export interface DocumentDetectorProxySettings {
  hostname: string;
  port: number;
  authentication?: DocumentDetectorProxySettingsAuthentication;
}

export interface DocumentDetectorPreviewSettings {
  show: boolean;
  title?: string;
  subtitle?: string;
  confirmLabel?: string;
  retryLabel?: string;
}

export interface DocumentDetectorSecuritySettings {
  useDevelopmentMode?: boolean;
  useAdb?: boolean;
  useDebug?: boolean;
}

export interface DocumentDetectorSettings {
  documentSteps: DocumentDetectorStep[];
  captureStages?: DocumentDetectorCaptureStage[];
  cafStage?: Stage;
  analyticsSettings?: boolean;
  popupSettings?: boolean;
  networkSettings?: number;
  sensorSettings?: DocumentDetectorSensorSettings;
  proxySettings?: DocumentDetectorProxySettings;
  previewSettings?: DocumentDetectorPreviewSettings;
  compressSettings?: number;
  manualCaptureSettings?: number;
  enableMultiLanguage?: boolean;
  enableGoogleServices?: boolean;
  imageUrlExpireTime?: string;
  currentStepDoneDelay?: number;
  resolutionSettings?: Resolution;
  allowedPassportList?: CountryCodes[];
  messageSettings?: DocumentDetectorMessageSettings;
  uploadSettings?: DocumentDetectorUploadSettings;
  securitySettings?: DocumentDetectorSecuritySettings;
  useManualCaptureAsFallback?: boolean;
  style?: DocumentDetectorStyle;
}
