import Dialog from '@material-hu/components/design-system/Dialog';

import { useLokaliseTranslation } from 'src/utils/i18n';

import { type CertificateInUseAction } from '../../types';

type CertificateInUseDialogProps = {
  certificateName: string;
  action: CertificateInUseAction;
  onClose: () => void;
};

const CertificateInUseDialog = ({
  certificateName,
  action,
  onClose,
}: CertificateInUseDialogProps) => {
  const { t } = useLokaliseTranslation('learning');

  return (
    <Dialog
      onClose={onClose}
      title={t(`settings.certificates.actions.${action}.in_use_title`, {
        certificateName,
      })}
      textBody={t(`settings.certificates.actions.${action}.in_use_body`)}
      primaryButtonProps={{
        children: t('general:understood'),
        onClick: onClose,
      }}
    />
  );
};

export default CertificateInUseDialog;
