import { TFunction } from 'i18next';

export enum DEPUTY_ENUM {
  SECRETARIAT = 'secretariat',
  INSPECTORATE = 'inspectorate',
  REHAB = 'rehab',
  LABORATORY = 'laboratory',
  ERADICATION = 'eradication',
  LEGAL = 'legal',
  PREVENTION = 'prevention',
  PUBLIC = 'public',
  HRD = 'hrd',
  RESEARCH = 'research',
}

export enum DEPUTY_GROUP {
  MAIN = 'main',
  RESEARCH = 'research',
}

export const ALL_DEPUTIES = [
  DEPUTY_ENUM.INSPECTORATE,
  DEPUTY_ENUM.SECRETARIAT,
  DEPUTY_ENUM.PREVENTION,
  DEPUTY_ENUM.PUBLIC,
  DEPUTY_ENUM.ERADICATION,
  DEPUTY_ENUM.REHAB,
  DEPUTY_ENUM.LEGAL,
  DEPUTY_ENUM.RESEARCH,
  DEPUTY_ENUM.HRD,
  DEPUTY_ENUM.LABORATORY,
];

export const getDeputyTitleFromRouteId = (id = '', t: TFunction) => {
  switch (id) {
    case DEPUTY_ENUM.SECRETARIAT:
      return t('division.secretariat');
    case DEPUTY_ENUM.INSPECTORATE:
      return t('division.inspectorate');
    case DEPUTY_ENUM.REHAB:
      return t('division.rehab');
    case DEPUTY_ENUM.LABORATORY:
    case 'lab':
      return t('division.laboratory');
    case DEPUTY_ENUM.ERADICATION:
      return t('division.eradication');
    case DEPUTY_ENUM.LEGAL:
      return t('division.legal');
    case DEPUTY_ENUM.PREVENTION:
      return t('division.prevention');
    case DEPUTY_ENUM.PUBLIC:
      return t('division.public');
    case DEPUTY_ENUM.HRD:
      return t('division.hrd');
    case DEPUTY_ENUM.RESEARCH:
    case 'puslitdatin':
      return t('division.research');
    default:
      return '';
  }
};

export const getGroupDeputy = (group = '') => {
  switch (group) {
    case DEPUTY_GROUP.MAIN:
      return ALL_DEPUTIES;
    case DEPUTY_GROUP.RESEARCH:
      return [DEPUTY_ENUM.RESEARCH, DEPUTY_ENUM.HRD, DEPUTY_ENUM.LABORATORY];
    default:
      return ALL_DEPUTIES;
  }
};
