import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProductsComponent } from './products/products.component';
import { CybersecurityComponent } from './cybersecurity/cybersecurity.component';
import { UPSComponent } from './ups/ups.component';
import { BlogComponent } from './blog/blog.component';
import { CelularesComponent } from './products/celulares/celulares.component';
import { PortatilesComponent } from './products/portatiles/portatiles.component';
import { OppoComponent } from './products/celulares/oppo/oppo.component';
import { SamsungComponent } from './products/celulares/samsung/samsung.component';
import { XiaomiComponent } from './products/celulares/xiaomi/xiaomi.component';

const routes: Routes = [
  { path: 'products/celulares/xiaomi', component: XiaomiComponent },
  { path: 'products/celulares/samsung', component: SamsungComponent },
  { path: 'products/celulares/oppo', component: OppoComponent },
  { path: 'products/portatiles', component: PortatilesComponent },
  { path: 'products/celulares', component: CelularesComponent },
  { path: 'blog', component: BlogComponent },
  { path: 'ups', component: UPSComponent },
  { path: 'cybersecurity', component: CybersecurityComponent },
  { path: 'products', component: ProductsComponent },
  { path: 'home', component: HomeComponent },
  // puedes tener otras rutas aquí
  { path: '', redirectTo: '/home', pathMatch: 'full' }, // Redirigir vacío a /home
  { path: '**', redirectTo: '/home' } // Ruta desconocida también a /home
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      scrollPositionRestoration: 'enabled', // 👈 importante
      anchorScrolling: 'enabled',          // opcional: si usas #anclas
    })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

