function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { useState } from 'react';
export var useDevicePlanningDialogs = function useDevicePlanningDialogs() {
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    addDeviceOpen = _useState2[0],
    setAddDeviceOpen = _useState2[1];
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    detailOpen = _useState4[0],
    setDetailOpen = _useState4[1];
  var _useState5 = useState(),
    _useState6 = _slicedToArray(_useState5, 2),
    selectedDevice = _useState6[0],
    setSelectedDevice = _useState6[1];
  var _useState7 = useState('info'),
    _useState8 = _slicedToArray(_useState7, 2),
    detailInitialTab = _useState8[0],
    setDetailInitialTab = _useState8[1];
  var _useState9 = useState(false),
    _useState10 = _slicedToArray(_useState9, 2),
    editDeviceOpen = _useState10[0],
    setEditDeviceOpen = _useState10[1];
  var _useState11 = useState(false),
    _useState12 = _slicedToArray(_useState11, 2),
    deleteDeviceOpen = _useState12[0],
    setDeleteDeviceOpen = _useState12[1];
  var _useState13 = useState(false),
    _useState14 = _slicedToArray(_useState13, 2),
    workAreaModalOpen = _useState14[0],
    setWorkAreaModalOpen = _useState14[1];
  var _useState15 = useState('create'),
    _useState16 = _slicedToArray(_useState15, 2),
    workAreaModalMode = _useState16[0],
    setWorkAreaModalMode = _useState16[1];
  var _useState17 = useState(),
    _useState18 = _slicedToArray(_useState17, 2),
    editingWorkArea = _useState18[0],
    setEditingWorkArea = _useState18[1];
  var openCreateWorkArea = function openCreateWorkArea() {
    setWorkAreaModalMode('create');
    setEditingWorkArea(undefined);
    setWorkAreaModalOpen(true);
  };
  var openEditWorkArea = function openEditWorkArea(record) {
    setWorkAreaModalMode('edit');
    setEditingWorkArea(record);
    setWorkAreaModalOpen(true);
  };
  var closeWorkAreaModal = function closeWorkAreaModal() {
    setWorkAreaModalOpen(false);
    setEditingWorkArea(undefined);
  };
  var openDeviceDetail = function openDeviceDetail(record, initialTab) {
    setSelectedDevice(record);
    setDetailInitialTab(initialTab);
    setDetailOpen(true);
  };
  var closeDeviceDetail = function closeDeviceDetail() {
    setDetailOpen(false);
    setSelectedDevice(undefined);
  };
  var clearSelectedDevice = function clearSelectedDevice() {
    setSelectedDevice(undefined);
  };
  return {
    addDeviceOpen: addDeviceOpen,
    detailOpen: detailOpen,
    selectedDevice: selectedDevice,
    detailInitialTab: detailInitialTab,
    editDeviceOpen: editDeviceOpen,
    deleteDeviceOpen: deleteDeviceOpen,
    workAreaModalOpen: workAreaModalOpen,
    workAreaModalMode: workAreaModalMode,
    editingWorkArea: editingWorkArea,
    setAddDeviceOpen: setAddDeviceOpen,
    setDetailOpen: setDetailOpen,
    setSelectedDevice: setSelectedDevice,
    setDetailInitialTab: setDetailInitialTab,
    setEditDeviceOpen: setEditDeviceOpen,
    setDeleteDeviceOpen: setDeleteDeviceOpen,
    setWorkAreaModalOpen: setWorkAreaModalOpen,
    openCreateWorkArea: openCreateWorkArea,
    openEditWorkArea: openEditWorkArea,
    closeWorkAreaModal: closeWorkAreaModal,
    openDeviceDetail: openDeviceDetail,
    closeDeviceDetail: closeDeviceDetail,
    clearSelectedDevice: clearSelectedDevice
  };
};