const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_context = require("../../context.js");
const require_index = require("../../deposit/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
require("./index.less");
//#region src/components/appointmentBooking/components/Deposit/index.tsx
const DepositContent = (props) => {
	const { isAgreeDepositPolicy, setIsAgreeDepositPolicy, deposit, depositProtocolRequest, showTitle = true } = props;
	return /* @__PURE__ */ react.default.createElement("div", { className: "appointment-deposit-wrap" }, showTitle ? /* @__PURE__ */ react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ react.default.createElement("span", null, _pisell_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellText.Amount, {
		value: deposit === null || deposit === void 0 ? void 0 : deposit.total,
		showCurrencySymbol: true,
		className: "amount"
	})) : null, /* @__PURE__ */ react.default.createElement(require_index.default, {
		total: deposit === null || deposit === void 0 ? void 0 : deposit.total,
		protocols: deposit === null || deposit === void 0 ? void 0 : deposit.protocols,
		isAgreePolicy: isAgreeDepositPolicy,
		onChange: (value) => setIsAgreeDepositPolicy(value),
		depositProtocolRequest
	}));
};
const Deposit = (props) => {
	const { showTitle = true } = props;
	const { setIsAgreeDepositPolicy, isAgreeDepositPolicy, summary, appointmentBooking } = require_context.useAppointmentBookingContext();
	const { deposit } = summary;
	const depositProtocolRequest = (id) => {
		var _appointmentBooking$g;
		return appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g = appointmentBooking.getProtocol) === null || _appointmentBooking$g === void 0 ? void 0 : _appointmentBooking$g.call(appointmentBooking, id);
	};
	return /* @__PURE__ */ react.default.createElement(DepositContent, {
		showTitle,
		isAgreeDepositPolicy: !!isAgreeDepositPolicy,
		setIsAgreeDepositPolicy,
		deposit,
		depositProtocolRequest
	});
};
//#endregion
exports.DepositContent = DepositContent;
exports.default = Deposit;
