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 service_linesSlice from "./service_lines/service_linesSlice";
import servicesSlice from "./services/servicesSlice";
import companiesSlice from "./companies/companiesSlice";
import contactsSlice from "./contacts/contactsSlice";
import tagsSlice from "./tags/tagsSlice";
import pipelinesSlice from "./pipelines/pipelinesSlice";
import deal_stagesSlice from "./deal_stages/deal_stagesSlice";
import leadsSlice from "./leads/leadsSlice";
import dealsSlice from "./deals/dealsSlice";
import project_templatesSlice from "./project_templates/project_templatesSlice";
import projectsSlice from "./projects/projectsSlice";
import milestonesSlice from "./milestones/milestonesSlice";
import tasksSlice from "./tasks/tasksSlice";
import task_dependenciesSlice from "./task_dependencies/task_dependenciesSlice";
import deliverablesSlice from "./deliverables/deliverablesSlice";
import project_risksSlice from "./project_risks/project_risksSlice";
import project_status_reportsSlice from "./project_status_reports/project_status_reportsSlice";
import skillsSlice from "./skills/skillsSlice";
import team_membersSlice from "./team_members/team_membersSlice";
import team_member_skillsSlice from "./team_member_skills/team_member_skillsSlice";
import resource_allocationsSlice from "./resource_allocations/resource_allocationsSlice";
import leave_requestsSlice from "./leave_requests/leave_requestsSlice";
import public_holidaysSlice from "./public_holidays/public_holidaysSlice";
import timesheetsSlice from "./timesheets/timesheetsSlice";
import time_entriesSlice from "./time_entries/time_entriesSlice";
import productsSlice from "./products/productsSlice";
import contractsSlice from "./contracts/contractsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_line_itemsSlice from "./invoice_line_items/invoice_line_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import support_slasSlice from "./support_slas/support_slasSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";
import ticket_commentsSlice from "./ticket_comments/ticket_commentsSlice";
import csat_surveysSlice from "./csat_surveys/csat_surveysSlice";
import email_templatesSlice from "./email_templates/email_templatesSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import importsSlice from "./imports/importsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
service_lines: service_linesSlice,
services: servicesSlice,
companies: companiesSlice,
contacts: contactsSlice,
tags: tagsSlice,
pipelines: pipelinesSlice,
deal_stages: deal_stagesSlice,
leads: leadsSlice,
deals: dealsSlice,
project_templates: project_templatesSlice,
projects: projectsSlice,
milestones: milestonesSlice,
tasks: tasksSlice,
task_dependencies: task_dependenciesSlice,
deliverables: deliverablesSlice,
project_risks: project_risksSlice,
project_status_reports: project_status_reportsSlice,
skills: skillsSlice,
team_members: team_membersSlice,
team_member_skills: team_member_skillsSlice,
resource_allocations: resource_allocationsSlice,
leave_requests: leave_requestsSlice,
public_holidays: public_holidaysSlice,
timesheets: timesheetsSlice,
time_entries: time_entriesSlice,
products: productsSlice,
contracts: contractsSlice,
invoices: invoicesSlice,
invoice_line_items: invoice_line_itemsSlice,
payments: paymentsSlice,
support_slas: support_slasSlice,
support_tickets: support_ticketsSlice,
ticket_comments: ticket_commentsSlice,
csat_surveys: csat_surveysSlice,
email_templates: email_templatesSlice,
notifications: notificationsSlice,
audit_logs: audit_logsSlice,
imports: importsSlice,
  },
})

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