import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { mock } from "../../mock.js";
import React from "react";
import { Image, PisellAvatar, PisellCard, PisellText } from "@pisell/materials";
import classNames from "classnames";
import defaultImage from "../../assets/image.svg";
import calendarHeartSvg from "../../assets/calendar-heart.svg";
import compassSvg from "../../assets/compass.svg";
import phoneSvg from "../../assets/phone.svg";
import "./index.less";
//#region src/components/eventBooking/components/resourceDisplay/index.tsx
const _excluded = [
	"dataSource",
	"mode",
	"showImage",
	"showTitle",
	"showSubtitle",
	"showLocation",
	"showContact",
	"direction",
	"shape",
	"size",
	"useTextAvatar",
	"className",
	"style",
	"onClick"
];
const PisellResourceCard = (_ref) => {
	let { dataSource, mode = "normal", showImage = true, showTitle = true, showSubtitle = true, showLocation = true, showContact = true, direction = "horizontal", shape = "circle", size = "xxl", useTextAvatar = false, className, style, onClick } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
	const { resource_display } = mock;
	const { image, title, subtitle, location, contact } = dataSource || resource_display;
	/**
	* @title: 渲染头像
	* @description:
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-09 20:57
	*/
	const renderAvatar = () => {
		if (!showImage) return null;
		return /* @__PURE__ */ React.createElement(PisellAvatar, {
			src: image || void 0,
			shape,
			size,
			useTextAvatar: !image,
			children: (rest === null || rest === void 0 ? void 0 : rest.children) || /* @__PURE__ */ React.createElement(Image, {
				src: defaultImage,
				preview: false
			}),
			className: classNames({
				"pisell-resource-card-campus-avatar": mode === "campus",
				"pisell-resource-card-empty-avatar": !image
			})
		});
	};
	/**
	* @title: 校区列表
	* @description:
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-09 21:22
	*/
	const campusLists = () => {
		let lists = [];
		if (showTitle && title) lists.push({
			key: "title",
			value: title,
			icon: calendarHeartSvg
		});
		if (showLocation && location) lists.push({
			key: "location",
			value: location,
			icon: compassSvg
		});
		if (showContact && contact) lists.push({
			key: "contact",
			value: contact,
			icon: phoneSvg
		});
		return lists;
	};
	/**
	* @title: 渲染内容
	* @description:
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-09 21:02
	*/
	const renderContent = () => {
		if (mode !== "campus") return /* @__PURE__ */ React.createElement(React.Fragment, null, showTitle && title && /* @__PURE__ */ React.createElement(PisellText, { className: "pisell-resource-card-name" }, title), showSubtitle && subtitle && /* @__PURE__ */ React.createElement(PisellText, { className: "pisell-resource-card-subtitle" }, subtitle));
		return /* @__PURE__ */ React.createElement("div", { className: "pisell-resource-card-campus-wrap" }, campusLists().map(({ key, value, icon }) => {
			return /* @__PURE__ */ React.createElement("div", {
				className: "pisell-resource-card-campus-item",
				key
			}, /* @__PURE__ */ React.createElement(Image, {
				src: icon,
				preview: false
			}), /* @__PURE__ */ React.createElement(PisellText, null, value));
		}));
	};
	return /* @__PURE__ */ React.createElement(PisellCard, _objectSpread2({
		className: classNames("pisell-resource-card", `pisell-resource-card-${direction}`, className),
		style,
		onClick
	}, rest), /* @__PURE__ */ React.createElement("div", { className: "pisell-resource-card-content" }, renderAvatar(), /* @__PURE__ */ React.createElement("div", { className: "pisell-resource-card-info" }, renderContent())));
};
//#endregion
export { PisellResourceCard as default };
