import useEngineContext from "../../../../../../hooks/useEngineContext.js";
import { useCart } from "../../../../../Sales/Cart/index.js";
import { useSummary } from "../../../../../Sales/Summary/index.js";
import React from "react";
import { locales } from "@pisell/utils";
import { PisellText } from "@pisell/materials";
import classNames from "classnames";
import "./index.less";
//#region src/components/eventBooking/components/Provider/Cart/Item/Total.tsx
const Total = ({ className, isFooter }) => {
	var _context$appHelper, _context$appHelper$ge, _cartData$cartItems, _cartData$cartItems2, _context$appHelper2, _context$appHelper2$g;
	const { cartData } = useCart();
	const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = useSummary();
	const context = useEngineContext();
	console.log(taxTitle, isPriceIncludeTax, totalTaxFee, total, context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getSymbolic) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper), deposit, "wh97978");
	const showDeposit = (cartData === null || cartData === void 0 || (_cartData$cartItems = cartData.cartItems) === null || _cartData$cartItems === void 0 ? void 0 : _cartData$cartItems.length) > 0 && (deposit === null || deposit === void 0 ? void 0 : deposit.hasDeposit);
	return /* @__PURE__ */ React.createElement("div", { className: `event-total-wrap ${className}` }, !isPriceIncludeTax && Number(totalTaxFee) > 0 ? /* @__PURE__ */ React.createElement("div", { className: "gst-wrap" }, /* @__PURE__ */ React.createElement("span", null, taxTitle, isFooter ? ": " : ""), /* @__PURE__ */ React.createElement(PisellText.Amount, {
		value: totalTaxFee,
		showCurrencySymbol: true
	})) : null, /* @__PURE__ */ React.createElement("div", { className: classNames("event-total", { [["total-gst-wrap"]]: !isPriceIncludeTax && Number(totalTaxFee) > 0 }) }, /* @__PURE__ */ React.createElement("div", { className: "left" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", null, isFooter && showDeposit ? locales.getText("pisell2.appointment.deposit") : locales.getText("pisell2.event.total"), isFooter ? ": " : ""), isFooter ? /* @__PURE__ */ React.createElement(PisellText.Amount, {
		value: (cartData === null || cartData === void 0 || (_cartData$cartItems2 = cartData.cartItems) === null || _cartData$cartItems2 === void 0 ? void 0 : _cartData$cartItems2.length) > 0 && (deposit === null || deposit === void 0 ? void 0 : deposit.hasDeposit) ? deposit === null || deposit === void 0 ? void 0 : deposit.total : total,
		showCurrencySymbol: true,
		className: "event-amount"
	}) : null), isPriceIncludeTax && Number(totalTaxFee) > 0 ? /* @__PURE__ */ React.createElement("span", { className: "gst" }, locales.getText("pisell2.event.total.gst")(`${isFooter ? `${taxTitle}: ` : taxTitle}`, `${context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 || (_context$appHelper2$g = _context$appHelper2.getSymbolic) === null || _context$appHelper2$g === void 0 ? void 0 : _context$appHelper2$g.call(_context$appHelper2)}${totalTaxFee}`)) : null), !isFooter ? /* @__PURE__ */ React.createElement(PisellText.Amount, {
		value: total,
		showCurrencySymbol: true,
		className: "event-amount"
	}) : null));
};
//#endregion
export { Total as default };
