import { Route, Routes } from 'react-router-dom';

// components
import PageNotFound from './pages/PageNotFound';
import Login from './pages/Login';
import ProtectedRoute from './components/ProtectedRoute';
import Dashboard from './pages/Dashboard';
import DashboardBeneficiario from './pages/DashboardBeneficiario';
import BandoViewBeneficiario from './pages/BandoViewBeneficiario';
import DefaultLayout from './layouts/DefaultLayout';
import Bandi from './pages/Bandi';
import BandoEdit from './pages/BandoEdit';
import BandoView from './pages/BandoView';
import BandoFormsEdit from './pages/BandoFormsEdit';
import BandoForms from './pages/BandoForms';
import BandoFormsPreview from './pages/BandoFormsPreview';
import BandoRendicontazioneSchemaEdit from './modules/rendicontazione/pages/BandoRendicontazioneSchemaEdit';
import RendicontazioneHome from './modules/rendicontazione/pages/RendicontazioneHome';
import RendicontazioniMie from './modules/rendicontazione/pages/RendicontazioniMie';
import PraticaRendicontazioneEdit from './modules/rendicontazione/pages/PraticaRendicontazioneEdit';
import DevSwitchUser from './modules/rendicontazione/pages/DevSwitchUser';
import IstruttoriaQueue from './modules/rendicontazione/pages/IstruttoriaQueue';
import IstruttoriaPratica from './modules/rendicontazione/pages/IstruttoriaPratica';
import Ar1Home from './modules/ar1/pages/Ar1Home';
import Ar1Wizard from './modules/ar1/pages/Ar1Wizard';
import Ar1Signature from './modules/ar1/pages/Ar1Signature';
import Ar1AdminConfig from './modules/ar1/pages/Ar1AdminConfig';
import BandoFlowEdit from './pages/BandoFlowEdit';
import Imieibandi from './pages/Imieibandi';
import BandoApplication from './pages/BandoApplication';
import Registration from './pages/Registration';
import BandiBeneficiario from './pages/BandiBeneficiario';
import LoginAdmin from './pages/LoginAdmin';
import Profile from './pages/Profile';
import ProfileCompany from './pages/ProfileCompany';
import Users from './pages/Users';
import AddCompany from './pages/AddCompany';
import ResetPassword from './pages/ResetPassword';
import DashboardPreInstructor from './pages/DashboardPreInstructor';
import ProfileBeneficiario from './pages/ProfileBeneficiario';
import Domande from './pages/Domande';
import DomandePreInstructor from './pages/DomandePreInstructor';
import DomandaEditPreInstructor from './pages/DomandaEditPreInstructor';
import SoccorsoIstruttorioPreInstructor from './pages/SoccorsoIstruttorioPreInstructor';
import SoccorsoEditPreInstructor from './pages/SoccorsoEditPreInstructor';
import SoccorsoAddPreInstructor from './pages/SoccorsoAddPreInstructor';
import DomandeBeneficiario from './pages/DomandeBeneficiario';
import SoccorsoEditBeneficiario from './pages/SoccorsoEditBeneficiario';
import BandoApplicationPreview from './pages/BandoApplicationPreview';
import BandiPreferredBeneficiario from './pages/BandiPreferredBeneficiario';
import DomandeInstructorManager from './pages/DomandeInstructorManager';
import DomandaEditInstructorManager from './pages/DomandaEditInstructorManager';
import UserActivity from './pages/UserActivity';
import DomandeArchive from './pages/DomandeArchive';
import BandiPreInstructor from './pages/BandiPreInstructor';
import BandoViewPreInstructor from './pages/BandoViewPreInstructor';
import DomandeArchivePreInstructor from './pages/DomandeArchivePreInstructor';
import DashboardInstructorManager from './pages/DashboardInstructorManager';
import DomandeMieInstructorManager from './pages/DomandeMieInstructorManager';
import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
import StatsBeneficiary from './pages/StatsBeneficiary';
import DocumentsBeneficiary from './pages/DocumentsBeneficiary';
import LoginConfidi from './pages/LoginConfidi';
import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
import DashboardBeneficiarioConfidi from './pages/DashboardBeneficiarioConfidi';
import DashboardDirector from './pages/DashboardDirector';
import Admin from './pages/Admin';
import AdminSetNdg from './pages/AdminSetNdg';
import AdminSetStatus from './pages/AdminSetStatus';
import AdminAmendmentReopen from './pages/AdminAmendmentReopen';
import AdminAmendmentExtend from './pages/AdminAmendmentExtend';
import AdminEliminaDomande from './pages/AdminEliminaDomande';
import AdminLog from './pages/AdminLog';
import AdminSendPec from './pages/AdminSendPec';
import AdminEmailTemplates from './pages/AdminEmailTemplates';

const routes = ({ role, chosenCompanyId }) => {

    return (
        <Routes>
            <Route element={<ProtectedRoute/>}>
                <Route path="/" element={<DefaultLayout>
                    {'ROLE_DIRECTOR' === role ? <DashboardDirector/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
                    {'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <DashboardBeneficiarioConfidi/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DashboardInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <Bandi/> : null}
                    {'ROLE_BENEFICIARY' === role ? <BandiBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <BandiBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <BandiPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandiPreInstructor/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoEdit/> : null}
                    {'ROLE_BENEFICIARY' === role ? <BandoViewBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <BandoViewBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <BandoViewPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoViewPreInstructor/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/preview" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/preview-evaluation" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/forms" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoForms/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/forms/:formId" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoFormsEdit/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/forms/:formId/preview" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoFormsPreview/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/flow" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoFlowEdit/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/rendicontazione" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <RendicontazioneHome/> : <PageNotFound/>}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi/:id/rendicontazione-schema" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoRendicontazioneSchemaEdit/> : <PageNotFound/>}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/rendicontazioni" element={<DefaultLayout>
                    {'ROLE_BENEFICIARY' === role ? <RendicontazioniMie/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <RendicontazioniMie/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/ar1" element={<DefaultLayout>
                    {'ROLE_BENEFICIARY' === role ? <Ar1Home/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <Ar1Home/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/ar1/wizard/:formId" element={<DefaultLayout>
                    {'ROLE_BENEFICIARY' === role ? <Ar1Wizard/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <Ar1Wizard/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/ar1/signature/:formId" element={<DefaultLayout>
                    {'ROLE_BENEFICIARY' === role ? <Ar1Signature/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <Ar1Signature/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/ar1-admin" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <Ar1AdminConfig/> : <PageNotFound/>}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/rendicontazioni/:id" element={<DefaultLayout>
                    {'ROLE_BENEFICIARY' === role ? <PraticaRendicontazioneEdit/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <PraticaRendicontazioneEdit/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/dev-switch-user" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <DevSwitchUser/> : <PageNotFound/>}
                </DefaultLayout>}/>
                <Route path="/istruttoria" element={<DefaultLayout>
                    {'ROLE_PRE_INSTRUCTOR' === role ? <IstruttoriaQueue/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <IstruttoriaQueue/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <IstruttoriaQueue/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/istruttoria/:id" element={<DefaultLayout>
                    {'ROLE_PRE_INSTRUCTOR' === role ? <IstruttoriaPratica/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <IstruttoriaPratica/> : null}
                    {'ROLE_SUPER_ADMIN' === role ? <IstruttoriaPratica/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/bandi-osservati" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <BandiPreferredBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <BandiPreferredBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/domande" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <Domande/> : null}
                    {'ROLE_BENEFICIARY' === role ? <DomandeBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <DomandeBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <DomandePreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/domande/:id/" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <DomandaEditPreInstructor/> : null}
                    {'ROLE_BENEFICIARY' === role ? <SoccorsoEditBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <SoccorsoEditBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditPreInstructor/> : null}
                </DefaultLayout>}/>
                <Route path="/domande/:id/preview" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_BENEFICIARY' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_CONFIDI' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : null}
                </DefaultLayout>}/>
                <Route path="/domande-archivio" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <DomandeArchive/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <DomandeArchivePreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeArchive/> : null}
                </DefaultLayout>}/>
                <Route path="/domande-archivio/:id/preview" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : null}
                </DefaultLayout>}/>
                <Route path="/domande/:id/aggiungi-soccorso" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoAddPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/domande/:id/soccorso/:amendmentId" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoEditPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditPreInstructor/> : null}
                </DefaultLayout>}/>
                <Route path="/soccorso-istruttorio/" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/mie-domande" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeMieInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/mie-domande/:id/" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/mie-domande/:id/aggiungi-soccorso" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoAddInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/mie-domande/:id/soccorso/:amendmentId" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/mio-soccorso-istruttorio/" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioMioInstructorManager/> : null}
                </DefaultLayout>}/>
                <Route path="/imieibandi" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <Imieibandi/> : null}
                    {'ROLE_CONFIDI' === role ? <Imieibandi/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/imieibandi/:id/" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null}
                    {'ROLE_CONFIDI' === role ? <BandoApplication/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/profilo" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <Profile/> : null}
                    {'ROLE_BENEFICIARY' === role ? <ProfileBeneficiario/> : null}
                    {'ROLE_CONFIDI' === role ? <ProfileBeneficiario/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <Profile/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <Profile/> : null}
                </DefaultLayout>}/>
                <Route path="/profilo-aziendale" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? (chosenCompanyId > 0 ? <ProfileCompany/> : <PageNotFound/>) : null}
                    {'ROLE_CONFIDI' === role ? (chosenCompanyId > 0 ? <ProfileCompany/> : <PageNotFound/>) : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/agguingi-azienda" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <AddCompany/> : null}
                    {'ROLE_CONFIDI' === role ? <AddCompany/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/utenti" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <Users/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/utenti/:id" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <UserActivity/> : null}
                    {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
                    {'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/stats" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <StatsBeneficiary/> : null}
                    {'ROLE_CONFIDI' === role ? <StatsBeneficiary/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/documenti" element={<DefaultLayout>
                    {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
                    {'ROLE_BENEFICIARY' === role ? <DocumentsBeneficiary/> : null}
                    {'ROLE_CONFIDI' === role ? <DocumentsBeneficiary/> : null}
                    {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
                    {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
                </DefaultLayout>}/>
                <Route path="/admin" element={<DefaultLayout>
                    <Admin/>
                </DefaultLayout>}/>
                <Route path="/admin/set-ndg" element={<DefaultLayout>
                    <AdminSetNdg/>
                </DefaultLayout>}/>
                <Route path="/admin/set-status" element={<DefaultLayout>
                    <AdminSetStatus/>
                </DefaultLayout>}/>
                <Route path="/admin/amendment-reopen" element={<DefaultLayout>
                    <AdminAmendmentReopen/>
                </DefaultLayout>}/>
                <Route path="/admin/amendment-extend" element={<DefaultLayout>
                    <AdminAmendmentExtend/>
                </DefaultLayout>}/>
                <Route path="/admin/elimina-domande" element={<DefaultLayout>
                    <AdminEliminaDomande/>
                </DefaultLayout>}/>
                <Route path="/admin/log" element={<DefaultLayout>
                    <AdminLog/>
                </DefaultLayout>}/>
                <Route path="/admin/send-pec" element={<DefaultLayout>
                    <AdminSendPec/>
                </DefaultLayout>}/>
                <Route path="/admin/email-templates" element={<DefaultLayout>
                    <AdminEmailTemplates/>
                </DefaultLayout>}/>
            </Route>
            <Route exact path="/reset-password" element={<ResetPassword/>}/>
            <Route exact path="/reset-password-admin" element={<ResetPasswordAdmin/>}/>
            <Route exact path="/login" element={<Login/>}/>
            <Route exact path="/loginadmin" element={<LoginAdmin/>}/>
            <Route exact path="/confidi" element={<LoginConfidi/>}/>
            <Route exact path="/registration" element={<Registration/>}/>
            <Route path="*" element={<PageNotFound/>}/>
        </Routes>)
};

export default routes;
