package com.sc.sicanet.migracion_sicanet.controller.catalogos;

import com.sc.sicanet.migracion_sicanet.DTO.catalogos.CatPeriodosDTO;
import com.sc.sicanet.migracion_sicanet.service.catalogos.CatPeriodosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/catalogo")
public class CatPeriodosController {
    @Autowired
    private CatPeriodosService catPeriodosService;

    @GetMapping("/periodos")
    public ResponseEntity<List<CatPeriodosDTO>> findAllPeriodos() {
        List<CatPeriodosDTO> periodos = catPeriodosService.findPeriodo();
        return new ResponseEntity<>(periodos, HttpStatus.OK);
    }
}