import _, { isEmpty } from 'lodash';
import { useContext } from 'react';
import { VmEmpty, VmLineCharts } from "../../../_components";
import { AlarmService } from "../../api";
import { RestaurantContext } from "../../index";
import { jsx as _jsx } from "react/jsx-runtime";
var AlarmTrend = function AlarmTrend(_ref) {
  var startDate = _ref.startDate,
    endDate = _ref.endDate;
  var _useContext = useContext(RestaurantContext),
    id = _useContext.id;
  var _AlarmService$useAlar = AlarmService.useAlarmTrend({
      id: id,
      startDate: startDate,
      endDate: endDate
    }),
    data = _AlarmService$useAlar.data,
    loading = _AlarmService$useAlar.loading;
  return !loading && isEmpty(data) ? /*#__PURE__*/_jsx(VmEmpty, {}) : /*#__PURE__*/_jsx(VmLineCharts, {
    xAxis: _.map(data, 'labelName'),
    dataList: _.map(data, 'labelValue'),
    unit: "\u6B21",
    legendOption: {
      width: '95%'
    },
    gridOption: {
      top: 70
    }
  });
};
export default AlarmTrend;