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 tenantsSlice from "./tenants/tenantsSlice";
import user_membershipsSlice from "./user_memberships/user_membershipsSlice";
import tenant_locationsSlice from "./tenant_locations/tenant_locationsSlice";
import pondsSlice from "./ponds/pondsSlice";
import speciesSlice from "./species/speciesSlice";
import batchesSlice from "./batches/batchesSlice";
import feed_productsSlice from "./feed_products/feed_productsSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import inventory_movementsSlice from "./inventory_movements/inventory_movementsSlice";
import feeding_logsSlice from "./feeding_logs/feeding_logsSlice";
import water_quality_logsSlice from "./water_quality_logs/water_quality_logsSlice";
import health_eventsSlice from "./health_events/health_eventsSlice";
import harvestsSlice from "./harvests/harvestsSlice";
import marketplace_listingsSlice from "./marketplace_listings/marketplace_listingsSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import payment_transactionsSlice from "./payment_transactions/payment_transactionsSlice";
import shipment_updatesSlice from "./shipment_updates/shipment_updatesSlice";
import investmentsSlice from "./investments/investmentsSlice";
import api_keysSlice from "./api_keys/api_keysSlice";
import webhook_endpointsSlice from "./webhook_endpoints/webhook_endpointsSlice";
import webhook_deliveriesSlice from "./webhook_deliveries/webhook_deliveriesSlice";
import email_notificationsSlice from "./email_notifications/email_notificationsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import csv_jobsSlice from "./csv_jobs/csv_jobsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
user_memberships: user_membershipsSlice,
tenant_locations: tenant_locationsSlice,
ponds: pondsSlice,
species: speciesSlice,
batches: batchesSlice,
feed_products: feed_productsSlice,
inventory_items: inventory_itemsSlice,
inventory_movements: inventory_movementsSlice,
feeding_logs: feeding_logsSlice,
water_quality_logs: water_quality_logsSlice,
health_events: health_eventsSlice,
harvests: harvestsSlice,
marketplace_listings: marketplace_listingsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
payment_transactions: payment_transactionsSlice,
shipment_updates: shipment_updatesSlice,
investments: investmentsSlice,
api_keys: api_keysSlice,
webhook_endpoints: webhook_endpointsSlice,
webhook_deliveries: webhook_deliveriesSlice,
email_notifications: email_notificationsSlice,
audit_logs: audit_logsSlice,
csv_jobs: csv_jobsSlice,
  },
})

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