import React, { useMemo } from 'react';
import { PisellHeaderProgressBar } from '@pisell/materials';
import { locales } from '@pisell/utils';
import "./index.less";
var STEP_TEXTS = {
  init: {
    index: 1,
    localeKey: 'pisell2.scan.order.step.init',
    fallback: 'Initialize'
  },
  product: {
    index: 2,
    localeKey: 'pisell2.scan.order.step.product',
    fallback: 'Select product'
  },
  check: {
    index: 3,
    localeKey: 'pisell2.scan.order.step.check',
    fallback: 'Check order'
  },
  error: {
    index: 4,
    localeKey: 'pisell2.scan.order.step.error',
    fallback: 'Unavailable'
  }
};
export default function Header(props) {
  var currentStep = props.currentStep,
    onBack = props.onBack;
  var stepText = useMemo(function () {
    var value = locales.getText('pisell2.appointment.step');
    if (typeof value === 'function') return value(STEP_TEXTS[currentStep].index);
    console.log('stepText', currentStep);
    return "Step ".concat(STEP_TEXTS[currentStep].index);
  }, [currentStep]);
  var title = useMemo(function () {
    var text = locales.getText(STEP_TEXTS[currentStep].localeKey);
    if (typeof text === 'string' && text) return text;
    return STEP_TEXTS[currentStep].fallback;
  }, [currentStep]);
  return /*#__PURE__*/React.createElement(PisellHeaderProgressBar, {
    className: "pisell-scan-order-progress-bar",
    stepText: stepText,
    title: title,
    showClose: false,
    showBack: currentStep !== 'init',
    onBack: onBack,
    enableBorder: true,
    borderColor: "#EAECF0"
  });
}