// src/moduleRoutes.js

// Import all necessary icons
import DashboardIcon from '@mui/icons-material/Dashboard';
import PeopleIcon from '@mui/icons-material/People';
import {NoteAdd as NoteAddIcon} from '@mui/icons-material';
import BuildSharpIcon from '@mui/icons-material/BuildSharp';
import BarChartIcon from '@mui/icons-material/BarChart';
import PollIcon from "@mui/icons-material/Poll";

// Import all of your module components
import HomeModule from '../components/HomeModule';
import CreateTenantModule from '../components/CreateTenantModule';
import CreateUserModule from '../components/CreateUserModule';
import RolesModule from '../components/RolesModule';

import ManageComplaintsModule from "../components/ManageComplaintsModule"
import FileComplaintModule from "../components/FileComplaintModule"
import CreatePoll from '../components/CreatePoll';

import Drafts from '../components/Drafts';
import RecentPolls from '../components/RecentPolls';
import RecentSurveys from '../components/RecentSurveys';
import PollsAndSurveysPage from '../components/Polls&SurveyUser';
//import UserHomePage from '../pages/UserHomePage';
import DynamicHomePage from '../components/HomeModule';
import EnhancedKnowledgeBase from '../pages/KnowledgeBase';

const moduleRoutes = [
  {
    name: 'Home',
    view: 'home',
    Element: DynamicHomePage,
    icon: <DashboardIcon sx={{ color: 'white' }} />,
    permissions: [],
    isNested: false,
    isShared: true, 
    isPublic: false, // Added: Accessible to citizens and officers.
  },
  {
    name: 'Polls&Surveys',
    view: 'polls&survey',
    icon: <BarChartIcon sx={{ color: 'white' }} />,
    isNested: true,
    children: [
      {
        name: 'Create poll/survey',
        view: 'createPollSurvey',
        Element: CreatePoll,
        permissions: ['create poll/survey'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with this permission.
      },
      {
        name: 'Recent Polls',
        view: 'recent-polls',
        Element: RecentPolls,
        permissions: ['view recent polls'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with this permission.
      },
      {
        name: 'Recent Surveys',
        view: 'recent-surveys',
        Element: RecentSurveys,
        permissions: ['view recent survey'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with this permission.
      },
      {
        name: 'Drafts',
        view: 'DraftPollsSurveys',
        Element:Drafts ,
        permissions: ['view drafts'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with this permission.
      },
    ],
  },
  {
    name: 'File a Complaint',
    view: 'file-complaint',
    Element: FileComplaintModule,
    icon: <NoteAddIcon sx={{ color: 'white' }} />,
    permissions: [],
    isNested: false,
    isShared: false,
    isPublic: true, // Added: Accessible to citizens and officers.
  },
  {
    name: 'Manage Complaints',
    view: 'manage-complaints',
    Element: ManageComplaintsModule,
    icon: <BuildSharpIcon sx={{ color: 'white' }} />, 
    permissions: ['complaints'],
    isNested: false,
    isShared: false,
    isPublic: false, // Added: Accessible only to officers with this permission.
  },
  {
    name: "Polls & Surveys",
    isNested: true,
    icon: <PollIcon sx={{ color: 'white' }} />,
    children: [
      {
        name: "User Polls & Surveys",
        view: "user-polls-surveys",
        Element: PollsAndSurveysPage,
        permissions: [],
        isShared: false,
        isPublic: true, // Added: Accessible to citizens and officers.
      },
    ],
  },
  {
    name: 'Create Tenant',
    view: 'create-tenant',
    Element: CreateTenantModule,
    icon: <PeopleIcon sx={{ color: 'white' }} />,
    permissions: ['createTenant'],
    isNested: false,
    isShared: false,
    isPublic: false, // Added: Accessible only to officers with this permission.
  },
  {
    name: 'Users',
    isNested: true,
    icon: <PeopleIcon sx={{ color: 'white' }} />,
    children: [
      {
        name: 'Create User',
        view: 'create-user',
        Element: CreateUserModule,
        permissions: ['users.add_users'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with this permission.
      },
      {
        name: 'Roles',
        view: 'roles',
        Element: RolesModule,
        permissions: ['users.add_roles', 'users.view_roles', 'users.change_roles', 'users.delete_roles'],
        isShared: false,
        isPublic: false, // Added: Accessible only to officers with these permissions.
      },
    ],
  },
  {
    name: 'Knowledge Base',
    view: 'knowledge-base',
    Element: EnhancedKnowledgeBase,
    icon: <BuildSharpIcon sx={{ color: 'white' }} />,
    permissions: ["complaints"],
    isNested: false,
    isShared: false,
    isPublic: false,

  }

];

export default moduleRoutes;