import { Visa_app_orderComponent } from './BuilderComponents/vpspack/Visa_app_order/Visa_app_order.component';
import { PagetComponent } from './BuilderComponents/vpspack/Paget/Paget.component';
import { GroupssComponent } from './BuilderComponents/vpspack/Groupss/Groupss.component';
import { MediaComponent } from './BuilderComponents/vpspack/Media/Media.component';
import { SiteComponent } from './BuilderComponents/vpspack/Site/Site.component';
import { RefrreresComponent } from './BuilderComponents/vpspack/Refrreres/Refrreres.component';
import { Refrreres_lineComponent } from './BuilderComponents/vpspack/Refrreres_line/Refrreres_line.component';
import { S_m_sComponent } from './BuilderComponents/vpspack/S_m_s/S_m_s.component';
import { XeroComponent } from './BuilderComponents/vpspack/Xero/Xero.component';
import { Sage_paysComponent } from './BuilderComponents/vpspack/Sage_pays/Sage_pays.component';
import { CouponComponent } from './BuilderComponents/vpspack/Coupon/Coupon.component';
import { NotificationComponent } from './BuilderComponents/vpspack/Notification/Notification.component';
import { StatusComponent } from './BuilderComponents/vpspack/Status/Status.component';
import { NationalityComponent } from './BuilderComponents/vpspack/Nationality/Nationality.component';
import { Visa_statusComponent } from './BuilderComponents/vpspack/Visa_status/Visa_status.component';
import { EmailsComponent } from './BuilderComponents/vpspack/Emails/Emails.component';
import { Refferere_reportComponent } from './BuilderComponents/vpspack/Refferere_report/Refferere_report.component';
import { Refferere_report_lineComponent } from './BuilderComponents/vpspack/Refferere_report_line/Refferere_report_line.component';
import { Customer_reportComponent } from './BuilderComponents/vpspack/Customer_report/Customer_report.component';
import { Supplier_reportComponent } from './BuilderComponents/vpspack/Supplier_report/Supplier_report.component';
import { Supplier_report_lineComponent } from './BuilderComponents/vpspack/Supplier_report_line/Supplier_report_line.component';
import { Agent_reportComponent } from './BuilderComponents/vpspack/Agent_report/Agent_report.component';
import { Agent_report_lineComponent } from './BuilderComponents/vpspack/Agent_report_line/Agent_report_line.component';
import { Sage_payComponent } from './BuilderComponents/vpspack/Sage_pay/Sage_pay.component';
import { Xero_invoices_lineComponent } from './BuilderComponents/vpspack/Xero_invoices_line/Xero_invoices_line.component';
import { Xero_invoicesComponent } from './BuilderComponents/vpspack/Xero_invoices/Xero_invoices.component';
import { Visa_pricesComponent } from './BuilderComponents/vpspack/Visa_prices/Visa_prices.component';
import { Visa_processing_timeComponent } from './BuilderComponents/vpspack/Visa_processing_time/Visa_processing_time.component';
import { Visa_durationComponent } from './BuilderComponents/vpspack/Visa_duration/Visa_duration.component';
import { Visa_billingComponent } from './BuilderComponents/vpspack/Visa_billing/Visa_billing.component';
import { Cost_sheet_uploadComponent } from './BuilderComponents/vpspack/Cost_sheet_upload/Cost_sheet_upload.component';
import { Upload_visaComponent } from './BuilderComponents/vpspack/Upload_visa/Upload_visa.component';
import { DeletedComponent } from './BuilderComponents/vpspack/Deleted/Deleted.component';
import { Deleted_childComponent } from './BuilderComponents/basicp1/Deleted_child/Deleted_child.component';
import { Completed_or_archiveComponent } from './BuilderComponents/vpspack/Completed_or_archive/Completed_or_archive.component';
import { Completed_or_archive_childComponent } from './BuilderComponents/vpspack/Completed_or_archive_child/Completed_or_archive_child.component';
import { RejectedComponent } from './BuilderComponents/vpspack/Rejected/Rejected.component';
import { Rejected_childComponent } from './BuilderComponents/vpspack/Rejected_child/Rejected_child.component';
import { RefundComponent } from './BuilderComponents/vpspack/Refund/Refund.component';
import { Refund_childComponent } from './BuilderComponents/vpspack/Refund_child/Refund_child.component';
import { Processing_agent_childComponent } from './BuilderComponents/vpspack/Processing_agent_child/Processing_agent_child.component';
import { Processing_agentComponent } from './BuilderComponents/vpspack/Processing_agent/Processing_agent.component';
import { Processing_customerComponent } from './BuilderComponents/vpspack/Processing_customer/Processing_customer.component';
import { Processing_customer_childComponent } from './BuilderComponents/vpspack/Processing_customer_child/Processing_customer_child.component';
import { Pending_agentComponent } from './BuilderComponents/vpspack/Pending_agent/Pending_agent.component';
import { Pending_agent_childComponent } from './BuilderComponents/vpspack/Pending_agent_child/Pending_agent_child.component';
import { Pending_customer_childComponent } from './BuilderComponents/vpspack/Pending_customer_child/Pending_customer_child.component';
import { Staff_applicationComponent } from './BuilderComponents/vpspack/Staff_application/Staff_application.component';
import { Pending_customerComponent } from './BuilderComponents/vpspack/Pending_customer/Pending_customer.component';
import { StaffappchildComponent } from './BuilderComponents/vpspack/Staffappchild/Staffappchild.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 { 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: '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:'Visa_app_order',component:Visa_app_orderComponent},


{path:'Paget',component:PagetComponent},


{path:'Groupss',component:GroupssComponent},


{path:'Media',component:MediaComponent},


{path:'Site',component:SiteComponent},


{path:'Refrreres',component:RefrreresComponent},


{path:'Refrreres_line',component:Refrreres_lineComponent},


{path:'S_m_s',component:S_m_sComponent},


{path:'Xero',component:XeroComponent},


{path:'Sage_pays',component:Sage_paysComponent},


{path:'Coupon',component:CouponComponent},


{path:'Notification',component:NotificationComponent},


{path:'Status',component:StatusComponent},


{path:'Nationality',component:NationalityComponent},


{path:'Visa_status',component:Visa_statusComponent},


{path:'Emails',component:EmailsComponent},


{path:'Refferere_report',component:Refferere_reportComponent},


{path:'Refferere_report_line',component:Refferere_report_lineComponent},


{path:'Customer_report',component:Customer_reportComponent},


{path:'Supplier_report',component:Supplier_reportComponent},


{path:'Supplier_report_line',component:Supplier_report_lineComponent},


{path:'Agent_report',component:Agent_reportComponent},


{path:'Agent_report_line',component:Agent_report_lineComponent},


{path:'Sage_pay',component:Sage_payComponent},


{path:'Xero_invoices_line',component:Xero_invoices_lineComponent},


{path:'Xero_invoices',component:Xero_invoicesComponent},


{path:'Visa_prices',component:Visa_pricesComponent},


{path:'Visa_processing_time',component:Visa_processing_timeComponent},


{path:'Visa_duration',component:Visa_durationComponent},


{path:'Visa_billing',component:Visa_billingComponent},


{path:'Cost_sheet_upload',component:Cost_sheet_uploadComponent},


{path:'Upload_visa',component:Upload_visaComponent},


{path:'Deleted',component:DeletedComponent},


{path:'Deleted_child',component:Deleted_childComponent},


{path:'Completed_or_archive',component:Completed_or_archiveComponent},


{path:'Completed_or_archive_child',component:Completed_or_archive_childComponent},


{path:'Rejected',component:RejectedComponent},


{path:'Rejected_child',component:Rejected_childComponent},


{path:'Refund',component:RefundComponent},


{path:'Refund_child',component:Refund_childComponent},


{path:'Processing_agent_child',component:Processing_agent_childComponent},


{path:'Processing_agent',component:Processing_agentComponent},


{path:'Processing_customer',component:Processing_customerComponent},


{path:'Processing_customer_child',component:Processing_customer_childComponent},


{path:'Pending_agent',component:Pending_agentComponent},


{path:'Pending_agent_child',component:Pending_agent_childComponent},


{path:'Pending_customer_child',component:Pending_customer_childComponent},


{path:'Staff_application',component:Staff_applicationComponent},


{path:'Pending_customer',component:Pending_customerComponent},


{path:'Staffappchild',component:StaffappchildComponent},



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

    ]
  },

];

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