// import { CommonModule } from '@angular/common';
// import { ChangeDetectionStrategy, Component, signal, effect, untracked } from '@angular/core';
// import { DataTable, SortState, TableColumn } from '@shared/components/data-table/data-table';
// import { Paginator } from '@shared/components/paginator/paginator';
// import { SearchBar } from '@shared/components/search-bar/search-bar';
// import { ZardButtonComponent } from '@shared/components/button/button.component';
// import { SortDir } from '@shared/paging/paging';
// import { Router } from '@angular/router';
// import { CourseReportSummary } from 'src/app/core/interfaces/report';
// import { ReportService } from 'src/app/core/services/report';

// @Component({
//   standalone: true,
//   selector: 'app-report-courses-list',
//   templateUrl: './report-list.html',
//   changeDetection: ChangeDetectionStrategy.OnPush,
//   imports: [CommonModule, DataTable, Paginator, SearchBar, ZardButtonComponent],
// })
// export class ReportCoursesListPage {
//   rows = signal<CourseReportSummary[]>([]);
//   total = signal(0);
//   page = signal(1);
//   perPage = signal(10);
//   search = signal('');
//   sort = signal<SortState>({ key: 'date', dir: 'desc' });
//   loading = signal(false);

//   cols: TableColumn<CourseReportSummary>[] = [
//     { key: 'course.dateDepartCourse', label: 'Date', sortable: true },
//     { key: 'course.numero', label: 'Numéro', sortable: true },
//     { key: 'course.nom', label: 'Nom', sortable: true },
//     { key: 'course.type', label: 'Type', sortable: true },
//     { key: 'course.reunion.hippodrome.nom', label: 'Lieu', sortable: true },
//     { key: 'course.particularite', label: 'Particularité' },
//     { key: 'statut', label: 'Statut', sortable: true },
//   ];

//   constructor(private api: ReportService, private router: Router) {
//     effect(() => {
//       const params = { page: this.page(), perPage: this.perPage(), search: this.search(), sortKey: this.sort().key, sortDir: this.sort().dir as SortDir };
//       untracked(() => this.fetch(params));
//     });
//   }

//   fetch(params: { page: number; perPage: number; search: string; sortKey: string; sortDir: SortDir }) {
//     this.loading.set(true);
//     this.api.list(params).subscribe((res) => {
//       this.rows.set(res.content);
//       this.total.set(res.pageable.total);
//       this.loading.set(false);
//     });
//   }

//   onSearch(q: string) { this.search.set(q); this.page.set(1); }

//   open(row: CourseReportSummary) {
//     this.router.navigate(['/rapport-courses', row.id]);
//   }
// }


