import { STORAGE_DASHBOARD, useTranslation } from 'core/i18n';
import { TypeUseStorageTranslation } from './types';
import { plural } from './helpers';

export function useStorageTranslations(
  selectedItemLength: number,
): TypeUseStorageTranslation {
  const { t } = useTranslation([STORAGE_DASHBOARD]);

  return {
    title: t('storage_dashboard:app.storage_dashboard.title'),

    leftSideBarMessages: {
      title: t('storage_dashboard:app.storage_dashboard.left_side_bar.title'),
      download: t(
        'storage_dashboard:app.storage_dashboard.left_side_bar.download',
      ),
    },
    table: {
      columnsMessages: {
        format: t(
          'storage_dashboard:app.storage_dashboard.table.columns.format',
        ),
        size: t('storage_dashboard:app.storage_dashboard.table.columns.size'),
        description: t(
          'storage_dashboard:app.storage_dashboard.table.columns.description',
        ),
        created: t(
          'storage_dashboard:app.storage_dashboard.table.columns.created',
        ),
        actions: t(
          'storage_dashboard:app.storage_dashboard.table.columns.actions',
        ),
      },
      cardInfoMessages: {
        description: t(
          'storage_dashboard:app.storage_dashboard.table.card_info.description',
        ),
        size: t('storage_dashboard:app.storage_dashboard.table.card_info.size'),
        created: t(
          'storage_dashboard:app.storage_dashboard.table.card_info.created',
        ),
        format: t(
          'storage_dashboard:app.storage_dashboard.table.card_info.format',
        ),
        crc: t('storage_dashboard:app.storage_dashboard.table.card_info.crc'),
      },
      drawerMessages: {
        header: {
          title: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.title',
          ),
        },
        crcFieldBoolean: {
          true: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.crc.boolean.true',
          ),
          false: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.crc.boolean.false',
          ),
        },
        footer: {
          downloadButton: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.download_button',
          ),
        },
      },
      successfulActionsMessages: {
        downloaded: {
          title: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.download_success_notification.title',
          ),
          subTitle: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.download_success_notification.sub_title',
            plural(selectedItemLength, 'success'),
          ),
        },
        deleted: {
          title: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.delete_success_notification.title',
          ),
          subTitle: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.delete_success_notification.sub_title',
            plural(selectedItemLength, 'success'),
          ),
        },
      },
      failedActionMessages: {
        downloaded: {
          title: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.download_error_notification.title',
          ),
          subTitle: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.download_error_notification.sub_title',
            plural(selectedItemLength, 'success'),
          ),
        },
        deleted: {
          title: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.delete_error_notification.title',
          ),
          subTitle: t(
            'storage_dashboard:app.storage_dashboard.table.card_info.delete_error_notification.sub_title',
            plural(selectedItemLength, 'success'),
          ),
        },
      },
    },
  };
}
