import React from 'react';
import { locales } from '@pisell/utils';
import { useStep, useSales } from "../../../../Sales";
import ProgressBar from "../../progressBar";
import { resourceTitle } from "../../../utils";
import "./index.less";
var Header = function Header() {
  var _steps$currentStepDat, _steps$currentStepDat2;
  var _useStep = useStep(),
    currentStepData = _useStep.currentStepData,
    closePage = _useStep.closePage,
    prevStep = _useStep.prevStep,
    isFirstStep = _useStep.isFirstStep;
  var _useSales = useSales(),
    removeSessionStorage = _useSales.removeSessionStorage,
    data = _useSales.data;

  /**
   * @title: 步骤数据多语言
   * @description:
   * @return {*}
   * @Author: WangHan
   * @Date: 2025-01-19 10:36
   */
  var steps = {
    'select-category': {
      title: locales.getText('pisell2.event.step')(1),
      description: locales.getText('pisell2.event.select.category')(resourceTitle(data))
    },
    'select-event': {
      title: locales.getText('pisell2.event.step')(2),
      description: locales.getText('pisell2.event.select.event')
    },
    'confirm-information': {
      title: locales.getText('pisell2.event.step')(3),
      description: locales.getText('pisell2.event.confirm.information')
    }
  };

  /**
   * @title: 返回
   * @description:
   * @return {*}
   * @Author: WangHan
   * @Date: 2025-01-18 22:28
   */
  var handleBack = function handleBack() {
    prevStep();
  };

  /**
   * @title: 关闭页面
   * @description:
   * @return {*}
   * @Author: WangHan
   * @Date: 2025-01-22 13:43
   */
  var handleClose = function handleClose() {
    closePage();
    removeSessionStorage();
  };
  return /*#__PURE__*/React.createElement(ProgressBar, {
    title: (_steps$currentStepDat = steps[currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key]) === null || _steps$currentStepDat === void 0 ? void 0 : _steps$currentStepDat.title,
    description: (_steps$currentStepDat2 = steps[currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.key]) === null || _steps$currentStepDat2 === void 0 ? void 0 : _steps$currentStepDat2.description,
    showBack: !isFirstStep,
    onBack: function onBack() {
      return handleBack();
    },
    onClose: function onClose() {
      return handleClose();
    },
    className: "event-booking-header"
  });
};
export default Header;