import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface DashboardState {
  totalOrgs: number;
  pendingRequests: number;
  orgAdmins: number;
}

const initialState: DashboardState = {
  totalOrgs: 0,
  pendingRequests: 0,
  orgAdmins: 0,
};

const dashboardSlice = createSlice({
  name: "dashboard",
  initialState,
  reducers: {
    setStats(state, action: PayloadAction<DashboardState>) {
      return { ...state, ...action.payload };
    },
  },
});

export const { setStats } = dashboardSlice.actions;
export default dashboardSlice.reducer;
