import { createSlice } from '@reduxjs/toolkit';

// interface AuthState {
//   canEdit: boolean;
//   canDelete: boolean;
// }

const auth = (window as any)?.userAuth;
const authInitState = {
  isAdmin: auth?.isAdmin ?? false,
  canEdit: auth?.canEdit ?? false,
  canDelete: auth?.canDelete ?? false,
  showMonitor: auth?.showMonitor ?? false,
  showCalendar: auth?.showCalendar ?? false,
  showDataview: auth?.showDataview ?? false,
  showConfig: auth?.showConfig ?? false,
  showUseredit: auth?.showUseredit ?? false,
  showSystem: auth?.showSystem ?? false,
  showMobileConfig: auth?.showMobileConfig ?? false,
  showContacts: auth?.showContacts ?? false,
  showDownload: auth?.showDownload ?? false,
  showBhb: auth?.showBhb ?? false,
  showLoRaWan: auth?.showLoRaWan ?? false,
  checkboxPerm: auth?.checkboxPerm ?? false,
  permID: auth?.permID ?? false,
  groupPermID: auth?.groupPermID ?? false,
  checkedPerm: auth?.checkedPerm ?? false,
  showMap: auth?.showMap ?? false,
};

const authenication = createSlice({
  name: 'authentication',
  initialState: authInitState,
  reducers: {},
});

export default authenication.reducer;
