import {
  IconBolt,
  IconCar,
  IconArmchair2,
  IconSmartHome,
  IconBuildingBank,
  IconCash,
} from '@material-hu/icons/tabler';

import { isDev, isProd, isSlot1, isStaging } from 'src/constants/env';
import { banBajioRoutes } from 'src/pages/dashboard/banBajio/routes';
import { LOAN } from 'src/types/banBajio';

export const INTEREST_RATE = 9.5;

export const canShowBanBajio = (instanceId: number) =>
  instanceId ===
  ((isSlot1 && 5) || (isDev && 17) || (isProd && 22792) || (isStaging && 496)); // TODO: Update to 7551 when BanBajio gets ready

export const MIN_ANTIQUITY = 12;
export const MIN_ANTIQUITY_SHORT_TERM = 3;

export const requestsOptions = [
  {
    title: 'LOAN',
    description: 'DESCRIPTION_LOAN',
    icon: IconBuildingBank,
    color: 'primary' as const,
    navigate: banBajioRoutes.loanRequests,
  },
  {
    title: 'ADVANCE_PAYMENT',
    description: 'DESCRIPTION_ADVANCE_PAYMENT',
    icon: IconCash,
    color: 'warning' as const,
    navigate: banBajioRoutes.advancePayment,
  },
];

export const loanRequestsOptions = [
  {
    title: 'SHORT_TERM',
    icon: IconBolt,
    color: 'primary' as const,
    loanType: LOAN.SHORT_TERM,
    showWarning: true,
    antiquityThreshold: MIN_ANTIQUITY_SHORT_TERM,
    antiquityKey: 'NOT_ALLOW_LOAN_DESCRIPTION_SHORT_TERM',
    libraryId: 764751,
  },
  {
    title: 'CAR',
    icon: IconCar,
    color: 'highlight' as const,
    loanType: LOAN.CAR,
    showWarning: true,
    antiquityThreshold: MIN_ANTIQUITY,
    antiquityKey: 'NOT_ALLOW_LOAN_DESCRIPTION_GENERAL',
  },
  {
    title: 'FURNITURE',
    icon: IconArmchair2,
    color: 'success' as const,
    loanType: LOAN.FURNITURE,
    showWarning: true,
    antiquityThreshold: MIN_ANTIQUITY,
    antiquityKey: 'NOT_ALLOW_LOAN_DESCRIPTION_GENERAL',
    libraryId: 764753,
  },
  {
    title: 'MORTGAGE',
    icon: IconSmartHome,
    color: 'warning' as const,
    loanType: LOAN.MORTGAGE,
    showWarning: false,
    antiquityThreshold: MIN_ANTIQUITY,
    antiquityKey: 'NOT_ALLOW_LOAN_DESCRIPTION_GENERAL',
    libraryId: 764752,
  },
];

export const CAR_OPTIONS = [
  {
    value: 1,
    label: 'NEW',
  },
  {
    value: 2,
    label: 'USED',
  },
];
