package com.pmu.betengine.controller; import com.pmu.betengine.model.CourseReportDetailRow; import com.pmu.betengine.service.CourseReportDetailRowService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/api/v1/course-report-detail-rows") @CrossOrigin(origins = "*") @Tag(name = "Gestion des détails de rapports de course", description = "Endpoints relatifs à l'objet CourseReportDetailRow") public class CourseReportDetailRowController { private final CourseReportDetailRowService service; public CourseReportDetailRowController(CourseReportDetailRowService service) { this.service = service; } @PostMapping @Operation(summary = "Créer un détail de rapport de course") public ResponseEntity create(@RequestBody CourseReportDetailRow row) { return ResponseEntity.ok(service.create(row)); } @GetMapping("/{id}") @Operation(summary = "Obtenir un détail par ID") public ResponseEntity getById(@PathVariable Long id) { return ResponseEntity.ok(service.getById(id)); } @GetMapping @Operation(summary = "Lister tous les détails de rapport") public ResponseEntity> getAll() { return ResponseEntity.ok(service.getAll()); } @PutMapping("/{id}") @Operation(summary = "Mettre à jour un détail de rapport") public ResponseEntity update(@PathVariable Long id, @RequestBody CourseReportDetailRow row) { return ResponseEntity.ok(service.update(id, row)); } @DeleteMapping("/{id}") @Operation(summary = "Supprimer un détail de rapport") public ResponseEntity delete(@PathVariable Long id) { service.delete(id); return ResponseEntity.ok("CourseReportDetailRow supprimé avec succès."); } @GetMapping("/detail/{detailId}") @Operation(summary = "Obtenir les détails par detailId") public ResponseEntity> getByDetailId(@PathVariable Long detailId) { return ResponseEntity.ok(service.getByDetailId(detailId)); } @GetMapping("/type-gain/{typeGain}") public ResponseEntity> getByTypeGain(@PathVariable String typeGain) { return ResponseEntity.ok(service.getByTypeGain(typeGain)); } @GetMapping("/type-jeu/{typeJeu}") public ResponseEntity> getByTypeJeu(@PathVariable String typeJeu) { return ResponseEntity.ok(service.getByTypeJeu(typeJeu)); } @GetMapping("/statut/{statut}") public ResponseEntity> getByStatut(@PathVariable String statut) { return ResponseEntity.ok(service.getByStatut(statut)); } @GetMapping("/distributed/{distributed}") public ResponseEntity> getByDistributed(@PathVariable Boolean distributed) { return ResponseEntity.ok(service.getByDistributed(distributed)); } @GetMapping("/externe/{externe}") public ResponseEntity> getByExterne(@PathVariable Boolean externe) { return ResponseEntity.ok(service.getByExterne(externe)); } }