import React from 'react';
import { ProgressBar } from '../progress-bar';
import { bytesToSize } from './file-uploader-helpers';
import { useTranslation } from '../hooks/use-translation';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
export default function UploadFileStatusMessage({
  isExpanded = false,
  completed = false,
  size = 0,
  details = '',
  showProgressBar = false,
  progressBarFile = {},
  showFileSize = true,
  showStatusMessage = true
}) {
  const {
    t
  } = useTranslation();
  const {
    progress = 0,
    statusMessage = t('Uploading...'),
    overrideStatusMessage = false,
    forceShowProgressBar = false
  } = progressBarFile;
  if (completed && !forceShowProgressBar) {
    if (!showFileSize) {
      return null;
    }
    return /*#__PURE__*/_jsx("div", {
      className: "file-uploader-file-size-message-wrapper",
      children: /*#__PURE__*/_jsx("span", {
        className: "file-uploader-file-size-message",
        "test-id": "file-uploader-file-size-message",
        children: overrideStatusMessage ? statusMessage : details || bytesToSize(size)
      })
    });
  }
  const progressBarContent = /*#__PURE__*/_jsx("div", {
    className: "file-uploader-progress-bar",
    "test-id": "file-uploader-progress-bar",
    children: /*#__PURE__*/_jsx(ProgressBar, {
      value: progress,
      max: 100,
      ariaLabel: statusMessage
    })
  });
  const isProgressBarShown = showProgressBar || forceShowProgressBar;
  if (isExpanded) {
    return /*#__PURE__*/_jsxs(_Fragment, {
      children: [/*#__PURE__*/_jsx("span", {
        className: "file-uploader-expanded-uploading-message",
        "test-id": "file-uploader-uploading-message",
        children: statusMessage
      }), isProgressBarShown && progressBarContent]
    });
  }
  return /*#__PURE__*/_jsx(_Fragment, {
    children: /*#__PURE__*/_jsxs("span", {
      className: "file-uploader-uploading-message",
      "test-id": "file-uploader-uploading-message",
      children: [isProgressBarShown && progressBarContent, showStatusMessage && statusMessage]
    })
  });
}