import React from 'react';
import { PisellCard } from '@pisell/materials';
import classNames from 'classnames';
import { mock } from "../../mock";
import "./index.less";
var EventResourceUsability = function EventResourceUsability(_ref) {
  var _ref$item = _ref.item,
    item = _ref$item === void 0 ? (mock === null || mock === void 0 ? void 0 : mock.resource_usability) || {} : _ref$item,
    _ref$showRemaining = _ref.showRemaining,
    showRemaining = _ref$showRemaining === void 0 ? true : _ref$showRemaining,
    _ref$showTime = _ref.showTime,
    showTime = _ref$showTime === void 0 ? true : _ref$showTime,
    className = _ref.className,
    style = _ref.style,
    onTimeSlotClick = _ref.onTimeSlotClick;
  var start_time = item.start_time,
    end_time = item.end_time,
    remainingCount = item.remainingCount,
    id = item.id,
    disabled = item.disabled,
    selected = item.selected;
  return /*#__PURE__*/React.createElement(PisellCard, {
    className: classNames('pisell-event-usability', {
      'pisell-event-usability-selected': selected
    }, className),
    style: style,
    borderRadius: 8,
    disabled: disabled,
    selected: selected,
    padding: 8
  }, /*#__PURE__*/React.createElement("div", {
    className: "pisell-event-usability-content"
  }, /*#__PURE__*/React.createElement("div", {
    className: "pisell-event-usability-slot",
    onClick: function onClick() {
      return onTimeSlotClick === null || onTimeSlotClick === void 0 ? void 0 : onTimeSlotClick(id);
    }
  }, showTime && /*#__PURE__*/React.createElement("div", {
    className: "pisell-event-usability-time"
  }, start_time, " ", end_time ? /*#__PURE__*/React.createElement("span", null, "~ ", end_time) : ''), showRemaining && /*#__PURE__*/React.createElement("div", {
    className: "pisell-event-usability-count"
  }, remainingCount, " Left"))));
};
export default EventResourceUsability;