import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { AuthGuard } from './auth/auth.guard';
import { LoginGuard } from './auth/login.guard';


// Componentes
import { IAMComponent } from './components/iam/iam.component';



import { MCOComponent } from './components/mco/mco.component';

import { MCOMAUComponent } from './components/mco/mcomau/mcomau.component';
import { MCOMAUFORMComponent } from './components/mco/mcomau/mcomau-form/mcomau-form.component';
import { MCOMBAComponent } from './components/mco/mcomba/mcomba.component';
import { MCOMDFComponent } from './components/mco/mcomdf/mcomdf.component';
import { MCOMDFFORMComponent } from './components/mco/mcomdf/mcomdf-form/mcomdf-form.component';
import { MCOMORComponent } from './components/mco/mcomor/mcomor.component';
import { MCOMPVComponent } from './components/mco/mcompv/mcompv.component';
import { MCOMUNComponent } from './components/mco/mcomun/mcomun.component';


import { MESComponent } from './components/mes/mes.component';

import { MESMAVComponent } from './components/mes/mesmav/mesmav.component';
import { MESMCCComponent } from './components/mes/mesmcc/mesmcc.component';
import { MESMCVComponent } from './components/mes/mesmcv/mesmcv.component';
import { MESMHSComponent } from './components/mes/mesmhs/mesmhs.component';
import { MESMPRComponent } from './components/mes/mesmpr/mesmpr.component';


import { MESMREComponent } from './components/mes/mesmre/mesmre.component';
import { MESMSVComponent } from './components/mes/mesmsv/mesmsv.component';


import { PAGE404Component } from './components/resources/page404/page404.component';
import { AdminGuard } from './auth/admin.guard';
import { UserGuard } from './auth/user.guard';
import { MCOMAPComponent } from './components/mco/mcomap/mcomap.component';
import { MCOMPVFORMComponent } from './components/mco/mcompv/mcompv-form/mcompv-form.component';


const APP_ROUTES: Routes = [

    
    { path: '', redirectTo: '/mesmpr', pathMatch: 'full'},
    { path: 'iam', component: IAMComponent, canActivate: [LoginGuard]},


    { path: 'admin', component: MCOComponent, canActivate: [ AdminGuard ],
        children: [
            { path: 'mcomau', component: MCOMAUComponent, canActivate: [AuthGuard]},
            { path: 'mcomau-form', component: MCOMAUFORMComponent, canActivate: [AuthGuard]},
            { path: 'mcomba', component: MCOMBAComponent, canActivate: [AuthGuard]},
            { path: 'mcomdf', component: MCOMDFComponent, canActivate: [AuthGuard]},
            { path: 'mcomdf-form', component: MCOMDFFORMComponent, canActivate: [AuthGuard]},
            { path: 'mcomor', component: MCOMORComponent, canActivate: [AuthGuard]},
            { path: 'mcompv', component: MCOMPVComponent, canActivate: [AuthGuard]},
            { path: 'mcompv-form', component: MCOMPVFORMComponent, canActivate: [AuthGuard]},
            { path: 'mcomun', component: MCOMUNComponent, canActivate: [AuthGuard]},
            { path: 'mcomap', component: MCOMAPComponent, canActivate: [AuthGuard]},

            { path: 'mesmpr', component: MESMPRComponent, canActivate: [AuthGuard]},
            { path: 'mesmav', component: MESMAVComponent, canActivate: [AuthGuard]},
            { path: 'mesmcc', component: MESMCCComponent, canActivate: [AuthGuard]},
            { path: 'mesmcv', component: MESMCVComponent, canActivate: [AuthGuard]},
            { path: 'mesmhs', component: MESMHSComponent, canActivate: [AuthGuard]},
            { path: 'mesmre', component: MESMREComponent, canActivate: [AuthGuard]},
            { path: 'mesmsv', component: MESMSVComponent, canActivate: [AuthGuard]},
            { path: '', redirectTo: 'admin/mesmpr', pathMatch: 'full'},
        ]
    },

    { path: '', component: MESComponent, canActivate: [ UserGuard ],
        children: [
            { path: 'mesmpr', component: MESMPRComponent, canActivate: [AuthGuard]},
            { path: 'mesmav', component: MESMAVComponent, canActivate: [AuthGuard]},
            { path: 'mesmcc', component: MESMCCComponent, canActivate: [AuthGuard]},
            { path: 'mesmhs', component: MESMHSComponent, canActivate: [AuthGuard]},
            { path: 'mesmre', component: MESMREComponent, canActivate: [AuthGuard]},
            { path: 'mesmsv', component: MESMSVComponent, canActivate: [AuthGuard]},
            { path: '', redirectTo: '/mesmpr', pathMatch: 'full'},
        ]
    },
    
    { path: '**', component: PAGE404Component }
];

export const APP_ROUTING = RouterModule.forRoot(APP_ROUTES)