import React, { useMemo } from "react";
import { Card, Col, Row, Statistic } from "@pisell/materials";
import "../index.less";
//#region src/components/ecocup/cupList/hooks/useSummary.tsx
const prefixCls = "ecocup-cup-list";
const useSummary = (locales, staticsData, isPartner) => {
	const summaryData = useMemo(() => {
		return [
			{
				key: "cup-rent",
				title: isPartner ? locales.getText("pisell2.text.ecocup.cup-rent") : locales.getText("pisell2.text.ecocup.eco.cup-rent"),
				value: (staticsData === null || staticsData === void 0 ? void 0 : staticsData.rent_count) || 0,
				type: "primary"
			},
			{
				key: "cup-returned",
				title: isPartner ? locales.getText("pisell2.text.ecocup.cup-returned") : locales.getText("pisell2.text.ecocup.eco.cup-returned"),
				value: (staticsData === null || staticsData === void 0 ? void 0 : staticsData.return_count) || 0,
				type: "primary"
			},
			{
				key: "available-to-rent",
				title: locales.getText("pisell2.text.ecocup.available-to-rent"),
				value: (staticsData === null || staticsData === void 0 ? void 0 : staticsData.in_stock_count) || 0
			}
		];
	}, [staticsData, isPartner]);
	return useMemo(() => {
		return () => /* @__PURE__ */ React.createElement(Row, {
			gutter: 8,
			className: `${prefixCls}-summary`
		}, summaryData.map((item) => {
			return /* @__PURE__ */ React.createElement(Col, {
				span: 8,
				key: item.key
			}, /* @__PURE__ */ React.createElement(Card, { className: `${prefixCls}-summary-card ${(item === null || item === void 0 ? void 0 : item.type) === "primary" ? `${prefixCls}-summary-primary` : ""}` }, /* @__PURE__ */ React.createElement(Statistic, {
				title: item.title,
				value: item.value,
				className: `${prefixCls}-summary-card-statistic`
			})));
		}));
	}, [summaryData]);
};
//#endregion
export { useSummary };
