package incheon.ags.pss.edit.smlt.web;

import java.util.List;

import javax.validation.Valid;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import incheon.ags.pss.edit.smlt.service.WindService;
import incheon.ags.pss.edit.smlt.vo.WindMonthlyRequestVO;
import incheon.ags.pss.edit.smlt.vo.WindMonthlyStatVO;
import incheon.com.cmm.api.DefaultApiResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 바람길 관리 컨트롤러
 * @author (User)
 */
@Controller
@RequiredArgsConstructor
@Slf4j
@RequestMapping("/pss/simulation/wind")
public class WindController {

    private final WindService windService;

    @PostMapping("/monthly.do")
    @ResponseBody
    public ResponseEntity<DefaultApiResponse> getWindMonthlyStats(
            @RequestBody @Valid WindMonthlyRequestVO vo) throws Exception {
        List<WindMonthlyStatVO> rows = windService.selectWindMonthlyStats(vo);
        return ResponseEntity.ok(DefaultApiResponse.success(rows, "조회되었습니다."));
    }
}