import { AxiosRequestConfig, Method as AxiosMethod } from 'axios';

export interface ResponseErrorEntity {
  message?: Error | string | string[];
  status: number;
}

export interface ResponseSuccessEntity<T = any> {
  data?: T;
  status: number;
}

export interface VariableURLEntity {
  [key: string]: string;
}

export interface ManagerParamsEntity {
  config?: AxiosRequestConfig;
  variableURL?: VariableURLEntity;
  onFailed?(error: ResponseErrorEntity): void;
  onSuccess?(response: ResponseSuccessEntity): void;
}

export type ResponseEntity = ResponseSuccessEntity | ResponseErrorEntity;

export interface ApiURLEntity {
  getManyUrl?: string;
  getOneUrl?: string;
  createUrl?: string;
  editUrl?: string;

  deleteUrl?: string;
  batchDeleteUrl?: string;

  confirmProcessDataUrl?: string;
  batchConfirmProcessDataUrl?: string;

  cancelProcessDataUrl?: string;
  batchCancelProcessDataUrl?: string;

  activateUrl?: string;
  batchActivateUrl?: string;

  deactivateUrl?: string;
  batchDeactivateUrl?: string;

  confirmProcessTransactionUrl?: string;
  batchConfirmProcessTransactionUrl?: string;

  cancelProcessTransactionUrl?: string;
  batchCancelProcessTransactionUrl?: string;

  rollbackProcessTransactionUrl?: string;
  batchRollbackProcessTransactionUrl?: string;

  holdProcessTransactionUrl?: string;
  batchHoldProcessTransactionUrl?: string;
}

export interface RequestMethodEntity {
  getManyMethod?: AxiosMethod;
  getOneMethod?: AxiosMethod;
  createMethod?: AxiosMethod;
  editMethod?: AxiosMethod;

  deleteMethod?: AxiosMethod;
  batchDeleteMethod?: AxiosMethod;

  confirmProcessDataMethod?: AxiosMethod;
  batchConfirmProcessDataMethod?: AxiosMethod;

  cancelProcessDataMethod?: AxiosMethod;
  batchCancelProcessDataMethod?: AxiosMethod;

  activateMethod?: AxiosMethod;
  batchActivateMethod?: AxiosMethod;

  deactivateMethod?: AxiosMethod;
  batchDeactivateMethod?: AxiosMethod;

  confirmProcessTransactionMethod?: AxiosMethod;
  batchConfirmProcessTransactionMethod?: AxiosMethod;

  cancelProcessTransactionMethod?: AxiosMethod;
  batchCancelProcessTransactionMethod?: AxiosMethod;

  rollbackProcessTransactionMethod?: AxiosMethod;
  batchRollbackProcessTransactionMethod?: AxiosMethod;

  holdProcessTransactionMethod?: AxiosMethod;
  batchHoldProcessTransactionMethod?: AxiosMethod;
}

export interface DataServicesConstructorEntity {
  baseUrl?: string;
  apiUrl?: string;
  urls?: ApiURLEntity;
  requestMethods?: RequestMethodEntity;
  moduleKey?: string;
}
