import { NewWorkOrderComponent } from './components/preventive-maintenance/work-orders/new-work-order/new-work-order.component';
import { WorkOrdersComponent } from './components/preventive-maintenance/work-orders/work-orders.component';
import { PreventiveMaintenanceComponent } from './components/preventive-maintenance/preventive-maintenance.component';
import { WebServiceAdminComponent } from './components/system-admin/web-services-admin/web-service-admin/web-service-admin.component';
import { ScadaWebServiceLinkComponent } from './components/system-admin/web-services-admin/scada-web-service-link/scada-web-service-link.component';
import { TokensAdminComponent } from './components/system-admin/web-services-admin/tokens-admin/tokens-admin.component';
import { ScadaAdminComponent } from './components/system-admin/web-services-admin/scada-admin/scada-admin.component';
import { NewTemplateComponent } from './components/system-admin/email-templates-config/new-template/new-template.component';
import { NewEmailServerComponent } from './components/system-admin/email-config/new-email-server/new-email-server.component';
import { BackupsComponent } from './components/system-admin/backups/backups.component';
import { SystemParamsComponent } from './components/system-admin/system-params/system-params.component';
import { EmailTemplatesConfigComponent } from './components/system-admin/email-templates-config/email-templates-config.component';
import { EmailConfigComponent } from './components/system-admin/email-config/email-config.component';
import { WebServicesAdminComponent } from './components/system-admin/web-services-admin/web-services-admin.component';
import { MaintenanceModeComponent } from './components/system-admin/maintenance-mode/maintenance-mode.component';
import { SecurityPoliticsComponent } from './components/system-admin/security-politics/security-politics.component';
import { EquipmentManagementComponent } from './components/equipment-management/equipment-management.component';
import { NewAdviceComponent } from './components/system-admin/advices/new-advice/new-advice.component';
import { AdvicesComponent } from './components/system-admin/advices/advices.component';
import { MenuItemComponent } from './components/template/menu-item/menu-item.component';
import { CatalogueViewerComponent } from './components/system-admin/catalogues/catalogue-viewer/catalogue-viewer.component';
import { DetailsComponent } from './components/system-admin/actions/details/details.component';
import { UpdateFormsComponent } from './components/system-admin/update-forms/update-forms.component';
import { CataloguesComponent } from './components/system-admin/catalogues/catalogues.component';
import { ActionsComponent } from './components/system-admin/actions/actions.component';
import { UserConnectionsComponent } from './components/system-admin/connections/user-connections/user-connections.component';
import { ConnectionsComponent } from './components/system-admin/connections/connections.component';
import { NewProfileComponent } from './components/users-profiles/profiles-admin/new-profile/new-profile.component';
import { ProfilesAdminComponent } from './components/users-profiles/profiles-admin/profiles-admin.component';
import { UsersAdminComponent } from './components/users-profiles/users-admin/users-admin.component';
import { SystemAdminComponent } from './components/system-admin/system-admin.component';
import { HomeComponent } from './components/home/home.component';
import { NewUserComponent } from './components/users-profiles/users-admin/new-user/new-user.component';
import { UsersProfilesComponent } from './components/users-profiles/users-profiles.component';
import { LoginComponent } from './components/login/login.component';
import { TemplateComponent } from './components/template/template.component';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginGuard } from './guards/login.guard';
import { AuthGuard } from './guards/auth.guard';

// import { GETBFOUPDATEComponent } from './components/getb/getbfo/getbfo-update/getbfo-update.component';

// Modulo: Workflow
import { WorkflowComponent } from './components/samwf/workflow.component';
import { WorkflowDetailComponent } from './components/samwf/workflow-detail/workflow-detail.component';
import { WorkflowDiagramaComponent } from './components/samwf/workflow-detail/workflow-diagrama/workflow-diagrama.component';
import { WorkflowPasosFormComponent } from './components/samwf/workflow-detail/workflow-tasks-form/workflow-pasos-form.component';
import { WorkflowVersionsHistoryComponent } from './components/samwf/workflow-versions-history/workflow-versions-history.component';
import { WorkflowRequestWorkflowComponent } from './components/samwf-user/workflow-request-workflow/workflow-request-workflow.component';
import { WorkflowAdvanceComponent } from './components/samwf-user/workflow-advance/workflow-advance.component';
import { WorkflowHistoryNotificationComponent } from './components/samwf-user/workflow-history-notification/workflow-history-notification.component';
import { TasksModuleComponent } from './components/samwf/tasks-module/tasks-module.component';
import { WorkflowAdminAdvanceComponent } from './components/samwf/workflow-admin-advance/workflow-admin-advance.component';
import { WorkflowTaskFormEditComponent } from './components/samwf/workflow-detail/workflow-task-form-edit/workflow-task-form-edit.component';

// Modulo: Gestión de Adquisiciones
import { AcquisitionManagementComponent } from './components/acquisition-management/acquisition-management.component';
import { AdquiComponent } from './components/acquisition-management/acquisition/acquisition.component';
import { PurchaseLineComponent } from './components/acquisition-management/acquisition/purchase-line/purchase-line.component';
import { ShoppingComponent } from './components/acquisition-management/acquisition/purchase-line/shopping/shopping.component';
import { ArtitleInformationComponent } from './components/acquisition-management/acquisition/purchase-line/artitle-information/artitle-information.component';
import { OrdersComponent } from './components/acquisition-management/acquisition/orders/orders.component';
import { GroupOrderComponent } from './components/acquisition-management/acquisition/orders/group-order/group-order.component';
import { DetailsOrderComponent } from './components/acquisition-management/acquisition/orders/details-order/details-order.component';
import { DocumentOrderComponent } from './components/acquisition-management/acquisition/orders/document-order/document-order.component';
import { ProviderComponent } from './components/acquisition-management/provider/provider.component';
import { ArtitleComponent } from './components/acquisition-management/provider/artitle/artitle.component';
import { GroupProviderComponent } from './components/acquisition-management/provider/artitle/group-provider/group-provider.component';
import { SelectedInformationComponent } from './components/acquisition-management/provider/artitle/selected-information/selected-information.component';
import { ProvidersComponent } from './components/acquisition-management/provider/providers/providers.component';
import { DispatchComponent } from './components/acquisition-management/dispatch/dispatch.component';
import { OrderReceptionComponent } from './components/acquisition-management/dispatch/order-reception/order-reception.component';
import { ShoppingCartComponent } from './components/acquisition-management/acquisition/purchase-line/shopping-cart/shopping-cart.component';
import { GroupRequestLineComponent } from './components/acquisition-management/acquisition/purchase-line/group-request-line/group-request-line.component';

// Formularios dinámicos
import { FormsManagementComponent } from './components/forms-management/forms-management.component';
import { FormDynManagementComponent } from './components/forms-management/form-dyn-management/form-dyn-management.component';
import { FormDynManagementFormComponent } from './components/forms-management/form-dyn-management/form-dyn-management-form/form-dyn-management-form.component';
import { ModuleManagementComponent } from './components/forms-management/module-management/module-management.component';
import { TableManagementComponent } from './components/forms-management/table-management/table-management.component';
import { TableManagementFormComponent } from './components/forms-management/table-management/table-management-form/table-management-form.component';


import { ArchitectureMonitoringComponent } from './components/system-admin/architecture-monitoring/architecture-monitoring.component';
import { LoginOldComponent } from './components/login/login-old/login-old.component';

// Modulo de Documentación Electronica
import { GDELComponent } from './components/gdel/gdel.component';
import { ADDOComponent } from './components/gdel/addo/addo.component';
import { DispatchManagementComponent } from './components/acquisition-management/dispatch/dispatch-management/dispatch-management.component';
import { DelayAnalysisComponent } from './components/acquisition-management/dispatch/delay-analysis/delay-analysis.component';
import { IssueTrackingComponent } from './components/acquisition-management/dispatch/issue-tracking/issue-tracking.component';
import { PartialDeliveriesComponent } from './components/acquisition-management/dispatch/partial-deliveries/partial-deliveries.component';
import { InvoiceComponent } from './components/acquisition-management/invoice/invoice.component';
import { ControlInvoiceComponent } from './components/acquisition-management/invoice/control-invoice/control-invoice.component';
import { CostsBudgetsComponent } from './components/acquisition-management/invoice/costs-budgets/costs-budgets.component';
import { PaymentOrderComponent } from './components/acquisition-management/invoice/payment-order/payment-order.component';
import { ProviderFormComponent } from './components/acquisition-management/provider/providers/provider-form/provider-form.component';
import { ArtitleFormComponent } from './components/acquisition-management/provider/artitle/artitle-form/artitle-form.component';
import { FailureAnalysisComponent } from './components/failure-analysis/failure-analysis.component';
import { FailureComponent } from './components/failure-analysis/failure/failure.component';
import { SymptomComponent } from './components/failure-analysis/symptom/symptom.component';
import { FailureChartComponent } from './components/failure-analysis/failure/failure-chart/failure-chart.component';
import { CatalogFailureComponent } from './components/failure-analysis/catalog-failure/catalog-failure.component';
import { CatalogMeasuresComponent } from './components/failure-analysis/catalog-measures/catalog-measures.component';
import { PersonalManagementComponent } from './components/personal-management/personal-management.component';
import { SubcontratistComponent } from './components/personal-management/subcontratist/subcontratist.component';
import { EmployeeComponent } from './components/personal-management/employee/employee.component';
import { InterventionComponent } from './components/personal-management/intervention/intervention.component';
import { WorkTeamComponent } from './components/personal-management/work-team/work-team.component';
import { SubcontratistFormComponent } from './components/personal-management/subcontratist/subcontratist-form/subcontratist-form.component';
import { ContractHistoryComponent } from './components/personal-management/subcontratist/contract-history/contract-history.component';
import { EmployeeFormComponent } from './components/personal-management/employee/employee-form/employee-form.component';
import { OrdersEmployeeComponent } from './components/personal-management/employee/orders-employee/orders-employee.component';
import { DocumentsEmployeeComponent } from './components/personal-management/employee/documents-employee/documents-employee.component';
import { ContractsHistoryEmployeeComponent } from './components/personal-management/employee/contracts-history-employee/contracts-history-employee.component';

const routes: Routes = [
  {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full' },
  {
    path: 'login',
    component: LoginComponent,
    canActivate: [LoginGuard]
  },
  {
    path: 'login-old',
    component: LoginOldComponent,
    canActivate: [LoginGuard],
  },
  {
    path: 'sam',
    component: TemplateComponent,
    canActivate: [AuthGuard],
    children: [
      //Página de inicio
      { path: 'home', component: HomeComponent },
      //Página de selección de submódulos y menús
      { path: 'module-options', component: MenuItemComponent },
      //Administración del sistema
      { path: 'ADSI', component: SystemAdminComponent },
      { path: 'ADSI/MAUS', component: ConnectionsComponent },                 //Monitoreo de acceso de los usuarios
      { path: 'ADSI/MAUS/detalles', component: UserConnectionsComponent },    //Detalles de accesos por usuario
      { path: 'ADSI/SAUS', component: ActionsComponent },                     //Seguimiento de acciones de los usuarios
      { path: 'ADSI/SAUS/detalles', component: DetailsComponent },            //Detalles de las acciones de los usuarios
      { path: 'ADSI/CRAV', component: AdvicesComponent },                     //Historial de avisos registrados
      { path: 'ADSI/CRAV/nuevo', component: NewAdviceComponent },             //Creación de avisos nuevos
      { path: 'ADSI/CRAV/editar', component: NewAdviceComponent },            //Edición de avisos
      { path: 'ADSI/POSE', component: SecurityPoliticsComponent },            //Políticas de seguridad
      { path: 'ADSI/MOMA', component: MaintenanceModeComponent },             //Modo mantenimiento
      { path: 'ADSI/ASWA', component: WebServicesAdminComponent },            //Administrador del servicio web de alarmas y contadores
      { path: 'ADSI/ASWA/ADSC', component: ScadaAdminComponent },             //Administrar SCADA
      { path: 'ADSI/ASWA/ADTO', component: TokensAdminComponent },            //Administrar tokens
      { path: 'ADSI/ASWA/ESSW', component: ScadaWebServiceLinkComponent },    //Enrutamiento de SCADAs al servicio web
      { path: 'ADSI/ASWA/LSWE', component: WebServiceAdminComponent },        //Lista de servicios web
      { path: 'ADSI/CCEL', component: EmailConfigComponent },                 //Configuración de correos electrónicos
      { path: 'ADSI/CCEL/nuevo', component: NewEmailServerComponent },        //Registro de servidor de correos electrónicos
      { path: 'ADSI/CCEL/editar', component: NewEmailServerComponent },       //Edición de servidor de correos electrónicos
      { path: 'ADSI/CPCE', component: EmailTemplatesConfigComponent },        //Configuración de plantillas de correos electrónicos
      { path: 'ADSI/CPCE/nuevo', component: NewTemplateComponent },           //Registro de una nueva plantilla de correos electrónicos
      { path: 'ADSI/CPCE/editar', component: NewTemplateComponent },          //Edición de una plantilla de correos electrónicos
      { path: 'ADSI/MACS', component: ArchitectureMonitoringComponent },      //Monitoreo de la arquitectura central del SAM
      { path: 'ADSI/AGCA', component: CataloguesComponent },                  //Administración global de catálogos
      { path: 'ADSI/AGCA/lector', component: CatalogueViewerComponent },
      { path: 'ADSI/CREAVI', component: AdvicesComponent },
      { path: 'ADSI/CREAVI/nuevo', component: NewAdviceComponent },
      { path: 'ADSI/MODFOR', component: UpdateFormsComponent },
      { path: 'ADSI/PASI', component: SystemParamsComponent }, //Parámetros del sistema
      { path: 'ADSI/GERE', component: BackupsComponent }, //Gestión de respaldos
      //Usuarios y perfiles
      { path: 'USPE', component: UsersProfilesComponent },
      { path: 'USPE/GEUS/ADUS', component: UsersAdminComponent },
      { path: 'USPE/GEUS/ADUS/crear', component: NewUserComponent },
      { path: 'USPE/GEPE/ADPE', component: ProfilesAdminComponent },
      { path: 'USPE/GEPE/ADPE/crear', component: NewProfileComponent },
      { path: 'USPE/GEPE/ADPE/editar', component: NewProfileComponent },
      { path: 'USPE/GEPE/ADPE/detalles', component: NewProfileComponent },
      //Gestión de los equipamientos
      { path: 'GESEQU', component: EquipmentManagementComponent },
      //Gestión de mantenimiento preventivo
      { path: 'GMPR', component: PreventiveMaintenanceComponent },
      { path: 'GMPR/ORTR/COTP', component: WorkOrdersComponent },
      { path: 'GMPR/ORTR/COTP/nuevo', component: NewWorkOrderComponent },
      //Rutas módulo usuarios y perfiles
      { path: 'users-profiles', component: UsersProfilesComponent },
      //Rutas módulo gestión de adquisiciones
      //Rutas módulo workflow
      //Rutas módulo administrador del sistema

      { path: 'ANFA', component:  FailureAnalysisComponent},
      { path: 'ANFA/failure', component:  FailureComponent},
      { path: 'ANFA/symptom', component:  SymptomComponent},
      { path: 'ANFA/failure/chart/:dataEquipment', component:  FailureChartComponent},
      { path: 'ANFA/catalog-failure', component:  CatalogFailureComponent},
      { path: 'ANFA/catalog-measures', component:  CatalogMeasuresComponent},
      // Modulo Inicio: Gestión de adquisiciones
        // Submodulo: Adquisiciones
        { path: 'GEAD', component: AcquisitionManagementComponent },
        { path: 'acquisition', component: AdquiComponent },
        { path: 'purchase-requisition-lines', component: PurchaseLineComponent },
        { path: 'shopping', component: ShoppingComponent },
        { path: 'shopping-cart', component: ShoppingCartComponent },
        { path: 'artitle-details/:idArtitle/:idProvider', component: ArtitleInformationComponent },
        { path: 'group-order', component: GroupOrderComponent },
        { path: 'details-order', component: DetailsOrderComponent },
        { path: 'document-order', component: DocumentOrderComponent },
        { path: 'orders', component: OrdersComponent },
        { path: 'group-request-line/:idRequestLine', component: GroupRequestLineComponent },

        // Submodulo: Proveedor
        { path: 'artitle-form/:form', component: ArtitleFormComponent },
        { path: 'provider', component: ProviderComponent },
        { path: 'provider-form/:form', component: ProviderFormComponent },
        { path: 'artitles', component: ArtitleComponent },
        { path: 'group-provider', component: GroupProviderComponent },
        { path: 'selected-information', component: SelectedInformationComponent },
        { path: 'providers', component: ProvidersComponent },

        // Submodulo: Despacho
        { path: 'dispatch', component: DispatchComponent },
        { path: 'order-reception', component: OrderReceptionComponent },
        { path: 'dispatch-management', component: DispatchManagementComponent },
        { path: 'delay-analysis', component: DelayAnalysisComponent },
        { path: 'issue-tracking', component: IssueTrackingComponent },
        { path: 'partial-deliveries', component: PartialDeliveriesComponent },

        // Submódulo: Facturas
        { path: 'invoice', component: InvoiceComponent },
        { path: 'control-invoice', component: ControlInvoiceComponent },
        { path: 'costs-budgets', component: CostsBudgetsComponent },
        { path: 'payment-order', component: PaymentOrderComponent },


      // Modulo Fin: Gestión de adquisiciones

      // Modulo Inicio: Formularios dinámicos
        { path: 'forms-management', component: FormsManagementComponent },
        { path: 'form-dyn-management', component: FormDynManagementComponent },
        { path: 'getbfo-create', component: FormDynManagementFormComponent },
        { path: 'getbfo-update/:id', component: FormDynManagementFormComponent },
        { path: 'module-management', component: ModuleManagementComponent },
        { path: 'table-management', component: TableManagementComponent },
      // Modulo Fin: Formularios dinámicos

      // Inicio: Workflow
        { path: 'tasks-module', component: TasksModuleComponent },
        { path: 'workflow', component: WorkflowComponent },
        { path: 'workflow/versions-history/:id', component: WorkflowVersionsHistoryComponent },
        { path: 'workflow/:id', component: WorkflowDetailComponent },
        { path: 'workflow/:id/tasksFlow', component: WorkflowPasosFormComponent },
        { path: 'workflow/:id/tasksFlowEdit', component: WorkflowTaskFormEditComponent },
        { path: 'requests-workflow', component: WorkflowRequestWorkflowComponent },
        { path: 'workflow/diagrama/:id', component: WorkflowDiagramaComponent },
        { path: 'requests-advance', component: WorkflowAdvanceComponent },
        { path: 'notification-history', component: WorkflowHistoryNotificationComponent },
      // Fin: Workflow

      // Inicio Gestion Documental Electronica
        { path: 'GDEL', component: GDELComponent },
        { path: 'GDEL/ADDO/crear', component: ADDOComponent },
        { path: 'GDEL/ADDO/editar', component: ADDOComponent },

      // Fin Gestion Documental Electronica

      // Inicio Gestion de Personal de Mantenimiento
        { path: 'GPRS', component: PersonalManagementComponent },
        { path: 'GPRS/subcontratist', component: SubcontratistComponent },
        { path: 'GPRS/subcontratist/contracts/:id', component: ContractHistoryComponent },
        { path: 'GPRS/subcontratist/form/:id/:enable', component: SubcontratistFormComponent },
        { path: 'GPRS/employee', component: EmployeeComponent },
        { path: 'GPRS/employee/form/:id/:enable', component: EmployeeFormComponent },
        { path: 'GPRS/employee/documents/:id', component: DocumentsEmployeeComponent },
        { path: 'GPRS/employee/orders/:id', component: OrdersEmployeeComponent },
        { path: 'GPRS/employee/contracts-history/:id', component: ContractsHistoryEmployeeComponent },
        { path: 'GPRS/intervention', component: InterventionComponent },
        { path: 'GPRS/intervention/contract-form/:enable', component: InterventionComponent },
        { path: 'GPRS/work-team', component: WorkTeamComponent },

      // Fin Gestion de Personal de Mantenimiento
    ],
  },
];

@NgModule({
  declarations: [],
  imports: [
    RouterModule.forRoot(routes, {
      useHash: true,
    }),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}
