import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms';

// Shared components
import { SharedModule } from '../../shared/shared.module';

// Dashboard components
import { DashboardGeneralComponent } from './components/dashboard-general.component';
import { DashboardFinanceComponent } from './components/dashboard-finance.component';
import { DashboardProjectsComponent } from './components/dashboard-projects.component';
import { DashboardReportingComponent } from './components/dashboard-reporting.component';

// Routes du module Dashboard
const routes: Routes = [
  {
    path: 'general',
    children: [
      { path: 'list', component: DashboardGeneralComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  {
    path: 'finance',
    children: [
      { path: 'list', component: DashboardFinanceComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  {
    path: 'projects',
    children: [
      { path: 'list', component: DashboardProjectsComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  {
    path: 'reporting',
    children: [
      { path: 'list', component: DashboardReportingComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  { path: '', redirectTo: 'general', pathMatch: 'full' }
];

@NgModule({
  declarations: [
    DashboardGeneralComponent,
    DashboardFinanceComponent,
    DashboardProjectsComponent,
    DashboardReportingComponent
  ],
  imports: [
    CommonModule,
    ReactiveFormsModule,
    RouterModule.forChild(routes),
    SharedModule
  ]
})
export class DashboardModule { }