import { Routes } from '@angular/router';
import { TeachersComponent } from './components/teachers/teachers.component';
import { SchoolYearsComponent } from './components/school-years/school-years.component';
import { ContractsComponent } from './components/contracts/contracts.component';
import { StructuresComponent } from './components/structures/structures.component';
import { ChildrenComponent } from './components/children/children.component';
import { ShiftsComponent } from './components/shifts/shifts.component';
import { LoginComponent } from './components/login/login.component';
import { authGuard } from './guards/auth.guard'; // Importa la guardia

export const routes: Routes = [
  { path: 'login', component: LoginComponent }, // Rotta per il login
  // Route protette
  { path: 'teachers', component: TeachersComponent, canActivate: [authGuard] },
  { path: 'school-years', component: SchoolYearsComponent, canActivate: [authGuard] },
  { path: 'contracts', component: ContractsComponent, canActivate: [authGuard] },
  { path: 'structures', component: StructuresComponent, canActivate: [authGuard] },
  { path: 'children', component: ChildrenComponent, canActivate: [authGuard] },
  { path: 'shifts', component: ShiftsComponent, canActivate: [authGuard] },
  // Redirect alla prima pagina (es. teachers) o a una dashboard se loggato
  // Redirect alla prima pagina protetta (es. teachers) o a login se non autenticato
  { path: '', redirectTo: '/teachers', pathMatch: 'full' },
  // TODO: Aggiungere una rotta wildcard (**) per pagina 404
];
