import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SidebarContentComponent } from './content/sidebar-content/sidebar-content.component';
import { LicensePrivacyTermsComponent } from './component/license-privacy-terms/license-privacy-terms.component';

const routes: Routes = [

 { path: 'login', loadChildren: () => import('./controls/login-control/login-control.module').then(m => m.LoginControlModule) },

 { path: 'license', component: LicensePrivacyTermsComponent},

  {
    path: 'main',
    component: SidebarContentComponent, // ✅ ใช้ layout นี้โดยตรง
    children: [
      {
        path: '',
        loadChildren: () =>
          import('./controls/main-control/main-control.module').then(
            (m) => m.MainControlModule
          ),
      },
    ],
  },

  { path: '', redirectTo: 'login', pathMatch: 'full' },

  { path: '**', redirectTo: 'login' }
];

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