import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { BaseLayoutComponent, CustomLayoutComponent, NotFoundComponent } from '@xdf/layouts';
import { AuthGuard, LoginComponent } from '@xdf/security';
import { BytebotLayoutComponent } from './modules/bytebot-layout/bytebot-layout/bytebot-layout.component';
import { HomeComponent } from './views/home/home.component';

const routes: Routes = [
  // Remover para SSO
  { path: 'login', component: LoginComponent },
  // Main redirect
  { path: '', redirectTo: 'home', pathMatch: 'full'},
  {
    path: '', component: CustomLayoutComponent,
    children: [
      { path: 'home', component: HomeComponent, data: { breadcrumb: 'Home' } }
    ]
  },
  { path: '', component: BaseLayoutComponent,
    children: [
      {
        path: 'dashboards', data: { breadcrumb: 'Dashboards' },
        loadChildren: () => import('./modules/dashboards/dashboards.module').then(m => m.DashboardsModule)
      },
    ]
  },
  { path: 'notpermitted', component: NotFoundComponent},

  // Handle all other routes
  { path: '**', component: NotFoundComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {
    scrollPositionRestoration: 'enabled',
    anchorScrolling: 'enabled',
    onSameUrlNavigation: 'ignore'
  })],
  exports: [RouterModule]
})
export class AppRoutingModule { }
