package com.concretepage.controller;

import com.concretepage.entity.Metric;
import com.concretepage.service.MetricService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("metric")
public class MetricController {

    @Autowired
    private MetricService metricService;

    @GetMapping("/{id}")
    public ResponseEntity<Metric> getMetricById(@PathVariable("id") Integer id) {
        Metric metric = metricService.getMetricById(id);
        return new ResponseEntity<Metric>(metric, HttpStatus.OK);
    }

    @GetMapping()
    public ResponseEntity<List<Metric>> getAllMetrics() {
        List<Metric> list = metricService.getAllMetrics();
        return new ResponseEntity<List<Metric>>(list, HttpStatus.OK);
    }

    @PutMapping()
    public ResponseEntity<Metric> updateMetric(@RequestBody Metric metric) {
        metricService.addMetric(metric);
        return new ResponseEntity<Metric>(metric, HttpStatus.OK);
    }

    @PutMapping("/all")
    public ResponseEntity<List<Metric>> updateMetrics(@RequestBody List<Metric> metrics) {
        metricService.addMetrics(metrics);
        return new ResponseEntity<List<Metric>>(metrics, HttpStatus.OK);
    }

    @DeleteMapping("{id}")
    public ResponseEntity<Void> deleteMetric(@PathVariable("id") Integer id) {
        metricService.deleteMetric(id);
        return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
    }


    @GetMapping("/deleteMetrics")
    public ResponseEntity<Void> deleteAllMetric() {
        metricService.deleteAll();
        return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
    }
}
@@ -715,38 +715,32 @@
  ResponseEntity%3C
-Metric
 %3E(metric, HttpSt
@@ -741,32 +741,32 @@
 HttpStatus.OK);%0A
+
     %7D%0A%0A    @GetM
@@ -925,28 +925,16 @@
 eEntity%3C
-List%3CMetric%3E
 %3E(list, 
@@ -1126,22 +1126,16 @@
 eEntity%3C
-Metric
 %3E(metric
@@ -1351,28 +1351,16 @@
 eEntity%3C
-List%3CMetric%3E
 %3E(metric
@@ -1557,36 +1557,32 @@
  ResponseEntity%3C
-Void
 %3E(HttpStatus.NO_
@@ -1716,24 +1716,24 @@
 eleteAll();%0A
+
         retu
@@ -1754,20 +1754,16 @@
 eEntity%3C
-Void
 %3E(HttpSt

Improve formatting