export enum ProcessTypes {
  Classification = 1,
  Template = 2,
  IDCard = 3,
  DriverLicense = 4,
  Invoice = 12,
  BasicOCR = 6,
}

export enum JobStatus {
  Success = '3',
  Failed = '0',
  ModelFailed = '4',
}

export enum ModelStatus {
  Success = 200,
  BlurryWithData = 201,
  BlurryWithoutData = 202,
  NotMatch = 401,
  Failed = 404,
}

export enum ApiCode {
  DuplicateBox = '4041',
}

export interface JobResponse<BaseResult> {
  id: number;
  data: BaseResult;
  status: JobStatus;
  files: {
    file_name: string;
    file_category: 'Origin' | 'Crop';
    file_url: string;
  }[];
}

export type RectPointTuple<PType = number> = [PType, PType, PType, PType];

export interface BaseResult {
  status: ModelStatus;
}

export interface InvoiceResult extends BaseResult {
  fields: Array<{
    label: string;
    value: string;
    box: RectPointTuple;
    confidence: number;
  }>;
}

export interface InvoiceResultDocClsBase extends BaseResult {
  content: {
    total_pages: number;
    ocr_num_pages: number;
    document: Document;
  };
}

export interface InvoiceResultDocCls extends BaseResult  {
  document: Array<{
    doc_type: string;
    start_page: number;
    end_page: number;
    content:  Array<{
      label: string;
      value: string
    }>
  }>;
}

export type Document = InvoiceResultDocCls;

export interface DriverLicenseResult extends BaseResult {
  content: {
    batch_words: string[];
    batch_preds: string[];
    batch_true_boxes: RectPointTuple[];
  };
}

export type IDCardResult = DriverLicenseResult;

export interface OtherDocumentsResult extends BaseResult {
  content: {
    boundingboxes: RectPointTuple[];
    texts: string[];
  };
}
