package incheon.sgp.rst.web;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import incheon.sgp.rst.service.RstLasuService;
import incheon.sgp.rst.vo.RstLasuResultVO;
import lombok.RequiredArgsConstructor;

/**
 * @ClassName : RstLasuController.java
 * @Description : 토지이용현황 통계 컨트롤러
 *
 * @author : 이주훈
 * @since : 2025. 11. 20
 * @version : 1.0
 *
 */
@Controller
@RequestMapping("/sgp/rst")
@RequiredArgsConstructor
public class RstLasuController {
	
	private final RstLasuService rstLasuService;
	
    // 기준연도 목록 조회
    @GetMapping("/lasu/crtrYrList.do")
    @ResponseBody
    public List<String> getCrtrYrList() throws Exception {
        return rstLasuService.selectCrtrYrList();
    }
    
    // 토지이용현황 통계 조회
    @GetMapping("/lasu/search.do")
    @ResponseBody
    public RstLasuResultVO searchLasu(
        @RequestParam String crtrYear,
        @RequestParam String sggCd,
        @RequestParam(required = false) String emdCd,
        @RequestParam(required = false) String liCd
    ) throws Exception
    {
    	RstLasuResultVO res = rstLasuService.getLasuStats(crtrYear, sggCd, emdCd, liCd);
        return res;
    }    
    
}
    
