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 workspacesSlice from "./workspaces/workspacesSlice";
import workspace_membershipsSlice from "./workspace_memberships/workspace_membershipsSlice";
import service_catalog_itemsSlice from "./service_catalog_items/service_catalog_itemsSlice";
import customersSlice from "./customers/customersSlice";
import propertiesSlice from "./properties/propertiesSlice";
import job_templatesSlice from "./job_templates/job_templatesSlice";
import jobsSlice from "./jobs/jobsSlice";
import job_assignmentsSlice from "./job_assignments/job_assignmentsSlice";
import checklistsSlice from "./checklists/checklistsSlice";
import checklist_itemsSlice from "./checklist_items/checklist_itemsSlice";
import job_checklist_runsSlice from "./job_checklist_runs/job_checklist_runsSlice";
import job_checklist_run_itemsSlice from "./job_checklist_run_items/job_checklist_run_itemsSlice";
import job_mediaSlice from "./job_media/job_mediaSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_line_itemsSlice from "./invoice_line_items/invoice_line_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import estimatesSlice from "./estimates/estimatesSlice";
import estimate_line_itemsSlice from "./estimate_line_items/estimate_line_itemsSlice";
import recurring_schedulesSlice from "./recurring_schedules/recurring_schedulesSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";
import plansSlice from "./plans/plansSlice";
import subscriptionsSlice from "./subscriptions/subscriptionsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
workspaces: workspacesSlice,
workspace_memberships: workspace_membershipsSlice,
service_catalog_items: service_catalog_itemsSlice,
customers: customersSlice,
properties: propertiesSlice,
job_templates: job_templatesSlice,
jobs: jobsSlice,
job_assignments: job_assignmentsSlice,
checklists: checklistsSlice,
checklist_items: checklist_itemsSlice,
job_checklist_runs: job_checklist_runsSlice,
job_checklist_run_items: job_checklist_run_itemsSlice,
job_media: job_mediaSlice,
invoices: invoicesSlice,
invoice_line_items: invoice_line_itemsSlice,
payments: paymentsSlice,
estimates: estimatesSlice,
estimate_line_items: estimate_line_itemsSlice,
recurring_schedules: recurring_schedulesSlice,
notifications: notificationsSlice,
support_tickets: support_ticketsSlice,
plans: plansSlice,
subscriptions: subscriptionsSlice,
  },
})

// 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
