import { CalculatorComponent } from './BuilderComponents/basic_calculator_app_20251004_122538-b/Calculator/Calculator.component';

import { SequencegenaratorComponent } from './fnd/sequencegenarator/sequencegenarator.component';
import { Component, NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { MainPageComponent } from '../main/fnd/main-page/main-page.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import { AboutComponent } from '../main/admin/about/about.component';
import { LayoutComponent } from './layout/layout.component';
import { UserComponent } from '../main/admin/user/user.component';

import { PasswordResetComponent } from '../main/admin/password-reset/password-reset.component';
import { DashboardComponent } from '../main/fnd/dashboard/dashboard.component';
import { AllMenuGroupComponent } from '../main/admin/menu-group/all/all-menu-group.component';
import { EditMenuGroupComponent } from '../main/admin/menu-group/edit/edit-menu-group.component';
import { MenuGroupComponent } from '../main/admin/menu-group/menu-group.component';
import { ReadOnlyMenuGroupComponent } from '../main/admin/menu-group/read-only/readonly-menu-group.component';
import { MenuRegisterComponent } from '../main/admin/menu-register/menu-register.component';
import { AllMenurComponent } from '../main/admin/menu-register/all-menur/all-menur.component';
import { AddMenurComponent } from '../main/admin/menu-register/add-menur/add-menur.component';
import { EditMenurComponent } from '../main/admin/menu-register/edit-menur/edit-menur.component';
import { ReadonlyMenurComponent } from '../main/admin/menu-register/readonly-menur/readonly-menur.component';
import { ProfileSettingComponent } from '../main/admin/profile-setting/profile-setting.component';
import { UsermaintanceComponent } from '../main/admin/usermaintance/usermaintance.component';
import { UsermaintanceaddComponent } from '../main/admin/usermaintanceadd/usermaintanceadd.component';
import { UsermaintanceeditComponent } from '../main/admin/usermaintanceedit/usermaintanceedit.component';
import { UsergrpmaintenanceComponent } from '../main/admin/usergrpmaintenance/usergrpmaintenance.component';
import { MenuaccesscontrolComponent } from '../main/admin/menuaccesscontrol/menuaccesscontrol.component';
import { AuthGuard } from '../../services/auth_guard.service';

import { SystemparametersComponent } from '../main/admin/systemparameters/systemparameters.component';
import { MenumaintanceComponent } from '../main/admin/menumaintance/menumaintance.component';

import { SubmenuComponent } from './admin/submenu/submenu.component';

import { Role } from '../../models/admin/role';
import { AccesstypeComponent } from './admin/accesstype/accesstype.component';
import { ModulesComponent } from './admin/modules/modules.component';

import { SessionloggerComponent } from './admin/sessionlogger/sessionlogger.component';
import { ReportRunnerComponent } from './builder/report-runner/report-runner.component';
import { ReportrunnerallComponent } from './builder/report-runner/reportrunnerall/reportrunnerall.component';
import { Reportrunneredit2Component } from './builder/report-runner/reportrunneredit2/reportrunneredit2.component';
import { ReportrunnereditComponent } from './builder/report-runner/reportrunneredit/reportrunneredit.component';
import { ReportBuildComponent } from './builder/report-build/report-build.component';
import { ReportbuildallComponent } from './builder/report-build/reportbuildall/reportbuildall.component';
import { ReportbuildaddComponent } from './builder/report-build/reportbuildadd/reportbuildadd.component';
import { ReportbuildeditComponent } from './builder/report-build/reportbuildedit/reportbuildedit.component';
import { ReportbuildqueryComponent } from './builder/report-build/reportbuildquery/reportbuildquery.component';
import { ReportBuild2Component } from './builder/report-build2/report-build2.component';
import { ReportBuild2allComponent } from './builder/report-build2/report-build2all/report-build2all.component';
import { ReportBuild2addComponent } from './builder/report-build2/report-build2add/report-build2add.component';
import { ReportBuild2editComponent } from './builder/report-build2/report-build2edit/report-build2edit.component';


import { DashboardnewComponent } from './builder/dashboardnew/dashboardnew.component';
import { AllnewdashComponent } from './builder/dashboardnew/allnewdash/allnewdash.component';
import { AddnewdashComponent } from './builder/dashboardnew/addnewdash/addnewdash.component';
import { EditformnewdashComponent } from './builder/dashboardnew/editformnewdash/editformnewdash.component';
import { EditnewdashComponent } from './builder/dashboardnew/editnewdash/editnewdash.component';
import { ScheduleComponent } from './builder/dashboardnew/schedule/schedule.component';
import { SetupiconComponent } from './builder/setupicon/setupicon.component';
import { ExtensionComponent } from './fnd/extension/extension.component';
import { AllextensionComponent } from './fnd/extension/allextension/allextension.component';
import { AddextensionComponent } from './fnd/extension/addextension/addextension.component';
import { EditextensionComponent } from './fnd/extension/editextension/editextension.component';
import { DashboardrunnerComponent } from './builder/dashboardrunner/dashboardrunner.component';
import { DashrunnerallComponent } from './builder/dashboardrunner/dashrunnerall/dashrunnerall.component';
import { DashrunnerlineComponent } from './builder/dashboardrunner/dashrunnerline/dashrunnerline.component';

import { ApiregisteryComponent } from './fnd/apiregistery/apiregistery.component';

import { DatamanagementComponent } from './datamanagement/datamanagement/datamanagement.component';
import { DatamananementworkflowComponent } from './datamanagement/datamananementworkflow/datamananementworkflow.component';
import { BulkimportComponent } from './datamanagement/bulkimport/bulkimport.component';
import { BulkimportallComponent } from './datamanagement/bulkimport/bulkimportall/bulkimportall.component';
import { BulkimportaddComponent } from './datamanagement/bulkimport/bulkimportadd/bulkimportadd.component';
import { BulkimporteditComponent } from './datamanagement/bulkimport/bulkimportedit/bulkimportedit.component';
import { BulkimportlineComponent } from './datamanagement/bulkimport/bulkimportline/bulkimportline.component';
import { BulkimporteditlineComponent } from './datamanagement/bulkimport/bulkimporteditline/bulkimporteditline.component';
import { MappingruleComponent } from './datamanagement/mappingrule/mappingrule.component';
import { MappingruleallComponent } from './datamanagement/mappingrule/mappingruleall/mappingruleall.component';
import { MappingruleaddComponent } from './datamanagement/mappingrule/mappingruleadd/mappingruleadd.component';
import { MappingruleeditComponent } from './datamanagement/mappingrule/mappingruleedit/mappingruleedit.component';
import { Stepper_workflowComponent } from './BuilderComponents/stepperworkflow/Stepper_workflow/Stepper_workflow.component';
import { Token_registeryComponent } from './fnd/Token_registery/Token_registery.component';
import { MyworkspaceComponent } from './admin/myworkspace/myworkspace.component';

// import { QueryComponent } from './superadmin/query/query.component';
// import { QueryaddComponent } from './superadmin/queryadd/queryadd.component';
// import { QueryeditComponent } from './superadmin/queryedit/queryedit.component';




const routes: Routes = [
  //Important: The sequence of path is important as the router go over then in sequential manner
  { path: '', redirectTo: '/cns-portal/dashboard', pathMatch: 'full' },
  {
    path: 'cns-portal',
    component: LayoutComponent,
    canActivate: [AuthGuard],
    children: [
      { path: '', redirectTo: 'user', pathMatch: 'full' },
      { path: 'main', component: MainPageComponent },
      { path: 'user', component: UserComponent },




      { path: 'usermaintance', component: UsermaintanceComponent },
      { path: 'usermaintanceadd', component: UsermaintanceaddComponent },
      { path: 'usermaintancedit/:id', component: UsermaintanceeditComponent },
      { path: 'usergrpmaintance', component: UsergrpmaintenanceComponent },
      { path: 'menuaccess', component: MenuaccesscontrolComponent },
      { path: 'systemparameters', component: SystemparametersComponent },
      { path: 'menumaintance', component: MenumaintanceComponent },
      { path: 'submenu/:id', component: SubmenuComponent },

      { path: 'passwordreset', component: PasswordResetComponent },
      { path: 'profile-settings', component: ProfileSettingComponent },
      { path: 'about', component: AboutComponent },
      { path: 'setupicon', component: SetupiconComponent },
      { path: 'myworkspace', component: MyworkspaceComponent },


      {
        path: 'reportbuild', component: ReportBuildComponent,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: ReportbuildallComponent },
          { path: 'add', component: ReportbuildaddComponent },
          { path: 'edit/:id', component: ReportbuildeditComponent },
          { path: 'reportQuery/:id', component: ReportbuildqueryComponent },


          //SUPER ADMIN
          // { path: 'query', component: QueryComponent, canActivate: [AuthGuard], data: { roles: [Role.Admin] } },
          // { path: 'reportQuery/:id/queryadd', component: QueryaddComponent, canActivate: [AuthGuard], data: { roles: [Role.Admin] } },
          // { path: 'reportQuery/queryedit/:id', component: QueryeditComponent, canActivate: [AuthGuard], data: { roles: [Role.Admin] } },



        ]
      },

      // {path:'rerunner',component:DatefunctionComponent},

      {
        path: 'reportbuild2', component: ReportBuild2Component,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: ReportBuild2allComponent },
          { path: 'add', component: ReportBuild2addComponent },
          { path: 'edit/:id', component: ReportBuild2editComponent },
        ]
      },

      //report runner
      {
        path: 'rerunner', component: ReportRunnerComponent,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: ReportrunnerallComponent },
          { path: 'runner2/:id', component: Reportrunneredit2Component },
          { path: 'runner/:id', component: ReportrunnereditComponent },
        ]
      },

      // dashboardbuilder
      {
        path: 'dashboardbuilder', component: DashboardnewComponent,
        children: [

          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: AllnewdashComponent },
          { path: 'adddata', component: AddnewdashComponent },
          { path: 'editdata/:id', component: EditformnewdashComponent },
          { path: 'editdashn/:id', component: EditnewdashComponent },
          { path: 'schedule/:id', component: ScheduleComponent },
        ]
      },

      {
        path: 'dashboardrunner', component: DashboardrunnerComponent,
        children: [

          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: DashrunnerallComponent },
          { path: 'dashrunner/:id', component: DashrunnerlineComponent },
        ]
      },


      { path: 'accesstype', component: AccesstypeComponent },
      { path: 'acmodules', component: ModulesComponent },
      { path: 'sessionlogger', component: SessionloggerComponent },
      { path: 'dashboard', component: DashboardComponent, },

      {
        path: 'menu-group', component: MenuGroupComponent,
        children: [
          { path: '', redirectTo: 'all-menu', pathMatch: 'full' },
          { path: 'all-menu', component: AllMenuGroupComponent },
          { path: 'edit-menu', component: EditMenuGroupComponent },
          { path: 'read-only', component: ReadOnlyMenuGroupComponent }
        ],
      },

      {
        path: 'menu-r', component: MenuRegisterComponent,
        children: [
          { path: '', redirectTo: 'all-r', pathMatch: 'full' },
          { path: 'all-r', component: AllMenurComponent },
          { path: 'add-r', component: AddMenurComponent },
          { path: 'edit-r', component: EditMenurComponent },
          { path: 'readonly-r', component: ReadonlyMenurComponent }
        ],
      },

      {
        path: 'extension', component: ExtensionComponent,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: AllextensionComponent },
          { path: 'add', component: AddextensionComponent },
          { path: 'edit/:id', component: EditextensionComponent },
        ],
      },
      { path: 'SequenceGenerator', component: SequencegenaratorComponent },
      { path: 'apiregistery', component: ApiregisteryComponent },


      // DATA MANAGEMENT

      { path: 'datamanagement', component: DatamanagementComponent },
      { path: 'dataworkflow/:id', component: DatamananementworkflowComponent },

      //bulk Import Rule
      {
        path: 'validationrule', component: BulkimportComponent,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: BulkimportallComponent },
          { path: 'add', component: BulkimportaddComponent },
          { path: 'edit/:id', component: BulkimporteditComponent },
          { path: 'ruleline', component: BulkimportlineComponent },
          { path: 'rulelineedit', component: BulkimporteditlineComponent },
        ],
      },
      //bulk Import Rule mapping
      {
        path: 'mappingrule', component: MappingruleComponent,
        children: [
          { path: '', redirectTo: 'all', pathMatch: 'full' },
          { path: 'all', component: MappingruleallComponent },
          { path: 'add', component: MappingruleaddComponent },
          { path: 'edit/:id', component: MappingruleeditComponent },
        ],
      },


      // buildercomponents
{path:'Calculator',component:CalculatorComponent},



      { path: 'tokenregistery', component: Token_registeryComponent },

      { path: 'Stepper_workflow', component: Stepper_workflowComponent },









      { path: '**', component: PageNotFoundComponent },

    ]
  },

];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class MainRoutingModule { }