import { createSlice } from "@reduxjs/toolkit";
import { userExtraReducers } from "./userExtraReducers";
import { userReducers } from "./userReducers";

const initialState = {
  statusModal: false,
  typeActivitySelected: null,
  pending: false,
  authToken: null,
  adminToken: null,
  userProfile: {},
  loginUserProfile: {},
  role: null,
  selectedRole: null,
  selectedSubUser: null,
  subUsers: [],
  isFirstLogin: true,
  userPath: "https://habackend.rasadyar.com/",
};
const slice = createSlice({
  name: "user",
  initialState,
  reducers: userReducers,
  extraReducers: userExtraReducers,
});

export const {
  LOG_OUT,
  AUTO_SIGN_IN,
  IS_FIRST_LOGIN,
  SET_MEDIATOR_TEXT,
  SET_SUBMENU_TEXT,
  SET_USER_PATH,
  SET_ADMIN_TOKEN,
  SET_TYPE_ACTIVITY_SELECTED,
  SET_SELECTED_ROLE,
  SET_SELECTED_SUB_USER,
  SET_SUB_USERS,
} = slice.actions;
// export default slice.reducer;
export const { reducer: userSlice } = slice;
