package com.progetto.VEBS.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.progetto.VEBS.model.dto.AreaVerdeDTO;
import com.progetto.VEBS.service.AreaVerdeService;

@RestController
@RequestMapping("/areaverde")
public class AreaVerdeController {
	
	  @Autowired
	  private final AreaVerdeService areaVerdeService;

	  public AreaVerdeController(AreaVerdeService areaVerdeService) {
	    this.areaVerdeService = areaVerdeService;
	  }

	  @GetMapping()
	  List<AreaVerdeDTO> getAll() {
	        return areaVerdeService.getAllAreeVerdi();
	  }

	  @GetMapping("/{id_area_verde}")
	  AreaVerdeDTO getById(@PathVariable Integer id_area_verde) {
	    return areaVerdeService.getAreaVerdeById(id_area_verde);
	  }
	  
}
