import { SYSTEMS_SETTINGS, useTranslation } from 'core/i18n';
import {
  Title,
  Menu,
  Button,
  Authentication,
  Tls,
  Notification,
  Validation,
} from './constatns';

export type TUseSettingsMessages = {
  title: { [key: string]: string };
  menu: {
    tls: { [key: string]: string };
    authentication: { [key: string]: string };
  };
  button: { [key: string]: string };
  authentication: { [key: string]: string };
  tls: { [key: string]: string };
  notification: { [key: string]: string };
  validation: { [key: string]: string };
};

export const useSettingsMessages = (): TUseSettingsMessages => {
  const { t } = useTranslation([SYSTEMS_SETTINGS]);

  return {
    title: {
      [Title.Title]: t('systems_settings:app.systems_settings.title'),
    },
    menu: {
      tls: { [Menu.Tls]: t('systems_settings:app.systems_settings.menu.tls') },

      authentication: {
        [Menu.Authentication]: t(
          'systems_settings:app.systems_settings.menu.authentication',
        ),
      },
    },
    button: {
      [Button.CreateNew]: t(
        'systems_settings:app.systems_settings.button.create_new',
      ),
      [Button.Delete]: t('systems_settings:app.systems_settings.button.delete'),
      [Button.Save]: t('systems_settings:app.systems_settings.button.save'),
      [Button.Cancel]: t('systems_settings:app.systems_settings.button.cancel'),
    },
    authentication: {
      [Authentication.CardTitleAuthentication]: t(
        'systems_settings:app.systems_settings.authentication.card_title_authentication',
      ),
      [Authentication.LimitingLogin]: t(
        'systems_settings:app.systems_settings.authentication.limiting_login',
      ),
      [Authentication.AuthenticationTimeout]: t(
        'systems_settings:app.systems_settings.authentication.authentication_timeout',
      ),
      [Authentication.LimitingLoginExtra]: t(
        'systems_settings:app.systems_settings.authentication.limiting_login_extra',
      ),
      [Authentication.AuthenticationTimeoutExtra]: t(
        'systems_settings:app.systems_settings.authentication.authentication_timeout_extra',
      ),
    },
    tls: {
      [Tls.EnabledTls]: t(
        'systems_settings:app.systems_settings.tls.enabled_tsl',
      ),
      [Tls.CardTitleTls]: t(
        'systems_settings:app.systems_settings.tls.card_title_tsl',
      ),
      [Tls.Certificate]: t(
        'systems_settings:app.systems_settings.tls.certificate',
      ),
      [Tls.AtTheMoment]: t(
        'systems_settings:app.systems_settings.tls.at_the_moment',
      ),
      [Tls.Edit]: t('systems_settings:app.systems_settings.tls.edit'),
      [Tls.SelectFile]: t(
        'systems_settings:app.systems_settings.tls.select_file',
      ),

      [Tls.Review]: t('systems_settings:app.systems_settings.tls.review'),
      [Tls.Key]: t('systems_settings:app.systems_settings.tls.key'),
      [Tls.CertNotUse]: t(
        'systems_settings:app.systems_settings.tls.certificate_not_used',
      ),
      [Tls.KeyNotUse]: t(
        'systems_settings:app.systems_settings.tls.key_not_used',
      ),
      [Tls.KeyExtra]: t('systems_settings:app.systems_settings.tls.key_extra'),
      [Tls.CrtExtra]: t('systems_settings:app.systems_settings.tls.crt_extra'),
    },
    notification: {
      [Notification.SavedSuccess]: t(
        'systems_settings:app.systems_settings.notification.saved_success',
      ),
      [Notification.TlsDeleted]: t(
        'systems_settings:app.systems_settings.notification.tsl_deleted',
      ),
      [Notification.TlsCreateNew]: t(
        'systems_settings:app.systems_settings.notification.tsl_create_new',
      ),
      [Notification.TooltipCancelButtonUpload]: t(
        'systems_settings:app.systems_settings.notification.tooltip_cancel_button_upload',
      ),
      [Notification.TooltipCancelButtonUploadOrCreateNew]: t(
        'systems_settings:app.systems_settings.notification.tooltip_cancel_button_upload_or_create_new',
      ),
      [Notification.WrongFormatTitle]: t(
        'systems_settings:app.systems_settings.notification.wrong_format_title',
      ),
      [Notification.WrongFormatDescriptionCert]: t(
        'systems_settings:app.systems_settings.notification.wrong_format_description_cert',
      ),
      [Notification.WrongFormatDescriptionKey]: t(
        'systems_settings:app.systems_settings.notification.wrong_format_description_key',
      ),
    },
    validation: {
      [Validation.NeedUploadCert]: t(
        'systems_settings:app.systems_settings.validation.need_upload_cert',
      ),
      [Validation.NeedUploadKey]: t(
        'systems_settings:app.systems_settings.validation.need_upload_key',
      ),
      [Validation.FieldNotEmpty]: t(
        'systems_settings:app.systems_settings.validation.fieldCanNotEmptyValidation',
      ),
    },
  };
};
