package br.gov.sigefp.budget.api;

import br.gov.sigefp.budget.api.dto.EconomicClassificationDTO;
import br.gov.sigefp.budget.service.EconomicClassificationService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/budget/economic-classifications")
@RequiredArgsConstructor
public class EconomicClassificationController {

    private final EconomicClassificationService service;

    @GetMapping
    public ResponseEntity<List<EconomicClassificationDTO>> findAll(
            @RequestParam(required = false) String type) {
        return ResponseEntity.ok(service.findAll(type));
    }
}
