/**
 * @Move (SQPM)
 * Only used by the Performance module - move to Performance/
 */
import Typography from '@material-hu/mui/Typography';

import { GoalCycleStatuses } from 'src/types/goals';
import { useLokaliseTranslation } from 'src/utils/i18n';

import Label from 'src/components/Label';

type Props = {
  status: GoalCycleStatuses;
};

const STATUS_COLOR_MAP = {
  [GoalCycleStatuses.DRAFT]: {
    background: '#FFFFFF',
    border: '#D0D1D4',
    label: '#757575',
  },
  [GoalCycleStatuses.IN_PROGRESS]: {
    background: '#E3F6F3',
    border: 'transparent',
    label: '#107569',
  },
  [GoalCycleStatuses.FINISHED]: {
    background: '#ECEDEE',
    border: 'transparent',
    label: '#757575',
  },
  [GoalCycleStatuses.PENDING]: {
    background: '#FEF1E1',
    border: 'transparent',
    label: '#B54708',
  },
};

const GoalCycleStatus = ({ status }: Props) => {
  const { t } = useLokaliseTranslation('backoffice_only');

  return (
    <Label
      color={STATUS_COLOR_MAP[status].background}
      sx={{
        border: '0.5px solid',
        borderColor: STATUS_COLOR_MAP[status].border,
      }}
      size="small"
    >
      <Typography
        variant="subtitle2"
        fontSize="12px"
        sx={{ color: STATUS_COLOR_MAP[status].label }}
      >
        {t('backoffice_only:goal_cycle_status.goal_cycle_status', {
          context: `${status}`,
        })}
      </Typography>
    </Label>
  );
};

export default GoalCycleStatus;
