/**
 * 收集点-总览信息-收运规则
 */
import { VmEmpty } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { BaseService } from "../../api";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
export default function Rules(props) {
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var id = props.id,
    paramConfigsList = props.paramConfigsList;
  var rules = BaseService.useGetRule(id);
  var getImgCode = function getImgCode(name) {
    var code = 'default';
    if (name.indexOf('厨余') > -1) {
      code = 'cy';
    } else if (name.indexOf('可回收') > -1) {
      code = 'khs';
    } else if (name.indexOf('有害') > -1) {
      code = 'yh';
    } else if (name.indexOf('其他') > -1) {
      code = 'qt';
    }
    return code;
  };
  return /*#__PURE__*/_jsx("div", {
    className: "cp-rules-wrapper ".concat(isDark ? 'dark' : ''),
    children: Array.isArray(rules) ? rules.map(function (ele, index) {
      var _paramConfigsList$SHO, _ele$rules;
      var typeCode = getImgCode((ele === null || ele === void 0 ? void 0 : ele.productTypeName) || '');
      var code = typeCode === 'default' ? 'khs' : typeCode;
      return /*#__PURE__*/_jsxs("div", {
        className: "cp-rules-item ".concat(code),
        children: [(ele === null || ele === void 0 ? void 0 : ele.ruleTypeName) && /*#__PURE__*/_jsx("div", {
          className: "cp-rules-item-type ".concat(code),
          children: ele.ruleTypeName
        }), /*#__PURE__*/_jsx("div", {
          className: "cp-rules-item--icon",
          children: /*#__PURE__*/_jsx("img", {
            src: require("../../imgs/".concat(code, ".png"))
          })
        }), /*#__PURE__*/_jsxs("div", {
          children: [/*#__PURE__*/_jsxs("div", {
            className: "cp-rules-item--row",
            children: [(ele === null || ele === void 0 ? void 0 : ele.productTypeName) || '--', ' ', ((_paramConfigsList$SHO = paramConfigsList['SHOW_COLLECTING_BUCKETS']) === null || _paramConfigsList$SHO === void 0 ? void 0 : _paramConfigsList$SHO.value) === 'true' && /*#__PURE__*/_jsxs(_Fragment, {
              children: [(ele === null || ele === void 0 ? void 0 : ele.bucketNum) || 0, "\u4E2A\u6876"]
            })]
          }), /*#__PURE__*/_jsx("div", {
            className: "cp-rules-item--row2",
            children: ele === null || ele === void 0 || (_ele$rules = ele.rules) === null || _ele$rules === void 0 ? void 0 : _ele$rules.map(function (rule) {
              return /*#__PURE__*/_jsxs("div", {
                children: [rule.ruleContent, rule.carCode ? " (".concat(rule.carCode, ")") : '']
              }, rule.ruleId);
            })
          }), (ele === null || ele === void 0 ? void 0 : ele.accUnitName) && /*#__PURE__*/_jsxs("div", {
            className: "cp-rules-item--row",
            children: [/*#__PURE__*/_jsx("div", {
              className: "cp-rules-item--row-label",
              children: "\u6536\u8FD0\u5355\u4F4D\uFF1A"
            }), /*#__PURE__*/_jsx("div", {
              className: "cp-rules-item--row-value",
              children: ele === null || ele === void 0 ? void 0 : ele.accUnitName
            })]
          })]
        })]
      }, index);
    }) : /*#__PURE__*/_jsx(VmEmpty, {
      type: "NO_DATA"
    })
  });
}