package com.bsis.peuplement.controler;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/dossierDistances")
public class DossierDistanceController {
/*
    @Autowired
    private DossierDistanceService dossierDistanceService;

    //......................................................................
    //                    Create
    //......................................................................
    @PostMapping("/add")
    public ResponseEntity<DossierDistance> addDossierDistance(@RequestBody DossierDistance dossierDistance) {
        DossierDistance newDossierDistance = dossierDistanceService.add(dossierDistance);
        return new ResponseEntity<>(newDossierDistance, HttpStatus.CREATED);
    }
    //...
    //......................................................................
    //                    Read
    //......................................................................
    @RequestMapping("/get/{id}")
    public Optional<DossierDistance> getDossierDistanceById(@PathVariable("id") String id) {
        return dossierDistanceService.getById(id);
    }
    //......................................................................
    @RequestMapping("/state/{dossierState}")
    public List<DossierDistance> getDossierDistanceByState(@PathVariable("dossierState") String dossierState) {
        return dossierDistanceService.getByDossierState(dossierState);

    }
    //......................................................................
    @RequestMapping("/getid/{dossierId}")
    public DossierDistance getDossierDistanceByDossierDistanceId(@PathVariable("dossierId") String dossierId) {
        return dossierDistanceService.getByDossierId(dossierId);
    }
    //......................................................................
    @GetMapping("/all")
    public ResponseEntity<List<DossierDistance>> getAll () {
        List<DossierDistance> dossierDistances = dossierDistanceService.getAll();
        return new ResponseEntity<>(dossierDistances, HttpStatus.OK);
    }
    //......................................................................
    //......................................................................
    @RequestMapping("/count")
    public long count() {
        return dossierDistanceService.count();
    }
    //......................................................................
    //                 Update
    //......................................................................
    @PutMapping("/update")
    public ResponseEntity<DossierDistance> update(@RequestBody DossierDistance dossierDistance) {
        DossierDistance updateDossierDistance = dossierDistanceService.update(dossierDistance);
        return new ResponseEntity<>(updateDossierDistance, HttpStatus.OK);
    }
    //......................................................................
    //                 Delete
    //......................................................................
    @DeleteMapping("/delete/{id}")
    public ResponseEntity<?> delete(@PathVariable("id") String id) {
        dossierDistanceService.delete(id);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    //......................................................................
    @RequestMapping("/deleteAll")
    public ResponseEntity<?> deleteAll() {
        dossierDistanceService.deleteAll();
        return new ResponseEntity<>(HttpStatus.OK);
    }*/
}