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 organization_invitationsSlice from "./organization_invitations/organization_invitationsSlice";
import customersSlice from "./customers/customersSlice";
import saved_addressesSlice from "./saved_addresses/saved_addressesSlice";
import service_packagesSlice from "./service_packages/service_packagesSlice";
import service_add_onsSlice from "./service_add_ons/service_add_onsSlice";
import service_requestsSlice from "./service_requests/service_requestsSlice";
import service_request_add_onsSlice from "./service_request_add_ons/service_request_add_onsSlice";
import request_checklist_itemsSlice from "./request_checklist_items/request_checklist_itemsSlice";
import request_timeline_eventsSlice from "./request_timeline_events/request_timeline_eventsSlice";
import request_documentsSlice from "./request_documents/request_documentsSlice";
import chat_threadsSlice from "./chat_threads/chat_threadsSlice";
import chat_messagesSlice from "./chat_messages/chat_messagesSlice";
import payment_transactionsSlice from "./payment_transactions/payment_transactionsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import subscriptionsSlice from "./subscriptions/subscriptionsSlice";
import legal_documentsSlice from "./legal_documents/legal_documentsSlice";
import document_acceptancesSlice from "./document_acceptances/document_acceptancesSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";
import leadsSlice from "./leads/leadsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import webhook_endpointsSlice from "./webhook_endpoints/webhook_endpointsSlice";
import webhook_deliveriesSlice from "./webhook_deliveries/webhook_deliveriesSlice";
import csv_jobsSlice from "./csv_jobs/csv_jobsSlice";
import usage_eventsSlice from "./usage_events/usage_eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
organization_invitations: organization_invitationsSlice,
customers: customersSlice,
saved_addresses: saved_addressesSlice,
service_packages: service_packagesSlice,
service_add_ons: service_add_onsSlice,
service_requests: service_requestsSlice,
service_request_add_ons: service_request_add_onsSlice,
request_checklist_items: request_checklist_itemsSlice,
request_timeline_events: request_timeline_eventsSlice,
request_documents: request_documentsSlice,
chat_threads: chat_threadsSlice,
chat_messages: chat_messagesSlice,
payment_transactions: payment_transactionsSlice,
invoices: invoicesSlice,
subscriptions: subscriptionsSlice,
legal_documents: legal_documentsSlice,
document_acceptances: document_acceptancesSlice,
support_tickets: support_ticketsSlice,
leads: leadsSlice,
notifications: notificationsSlice,
audit_logs: audit_logsSlice,
webhook_endpoints: webhook_endpointsSlice,
webhook_deliveries: webhook_deliveriesSlice,
csv_jobs: csv_jobsSlice,
usage_events: usage_eventsSlice,
  },
})

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