import { configureStore } from '@reduxjs/toolkit';
import styleReducer from './styleSlice';
import mainReducer from './mainSlice';
import authSlice from './authSlice';
import openAiSlice from './openAiSlice';

import usersSlice from "./users/usersSlice";
import rolesSlice from "./roles/rolesSlice";
import permissionsSlice from "./permissions/permissionsSlice";
import organizationsSlice from "./organizations/organizationsSlice";
import companiesSlice from "./companies/companiesSlice";
import role_permissionsSlice from "./role_permissions/role_permissionsSlice";
import user_rolesSlice from "./user_roles/user_rolesSlice";
import departmentsSlice from "./departments/departmentsSlice";
import job_titlesSlice from "./job_titles/job_titlesSlice";
import work_locationsSlice from "./work_locations/work_locationsSlice";
import employeesSlice from "./employees/employeesSlice";
import employment_contractsSlice from "./employment_contracts/employment_contractsSlice";
import leave_typesSlice from "./leave_types/leave_typesSlice";
import leave_requestsSlice from "./leave_requests/leave_requestsSlice";
import attendance_policiesSlice from "./attendance_policies/attendance_policiesSlice";
import work_schedulesSlice from "./work_schedules/work_schedulesSlice";
import employee_schedule_assignmentsSlice from "./employee_schedule_assignments/employee_schedule_assignmentsSlice";
import time_entriesSlice from "./time_entries/time_entriesSlice";
import holidaysSlice from "./holidays/holidaysSlice";
import expense_categoriesSlice from "./expense_categories/expense_categoriesSlice";
import expense_claimsSlice from "./expense_claims/expense_claimsSlice";
import documentsSlice from "./documents/documentsSlice";
import announcementsSlice from "./announcements/announcementsSlice";
import api_configsSlice from "./api_configs/api_configsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";

export const store = configureStore({
  reducer: {
    style: styleReducer,
    main: mainReducer,
    auth: authSlice,
    openAi: openAiSlice,

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
role_permissions: role_permissionsSlice,
user_roles: user_rolesSlice,
departments: departmentsSlice,
job_titles: job_titlesSlice,
work_locations: work_locationsSlice,
employees: employeesSlice,
employment_contracts: employment_contractsSlice,
leave_types: leave_typesSlice,
leave_requests: leave_requestsSlice,
attendance_policies: attendance_policiesSlice,
work_schedules: work_schedulesSlice,
employee_schedule_assignments: employee_schedule_assignmentsSlice,
time_entries: time_entriesSlice,
holidays: holidaysSlice,
expense_categories: expense_categoriesSlice,
expense_claims: expense_claimsSlice,
documents: documentsSlice,
announcements: announcementsSlice,
api_configs: api_configsSlice,
audit_logs: audit_logsSlice,
  },
})

// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch
