package incheon.sgp.bas.web;

import incheon.sgp.bas.service.BasMapService;
import incheon.sgp.tdr.vo.DronePoiVO;
import incheon.sgp.tdr.vo.TdrRequestVO;
import lombok.RequiredArgsConstructor;
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.RestController;

import java.util.List;

/**
 * BAS 모듈의 REST API 컨트롤러
 */
@RestController
@RequestMapping("/sgp/bas/api")
@RequiredArgsConstructor
public class BasApiController {

    private final BasMapService porMapService;

    @PostMapping(value = "/getDronePoiList.do", produces = "application/json; charset=UTF-8")
    public List<DronePoiVO> getDronePoiList(@RequestBody TdrRequestVO tdrRequestVO) {
        if (tdrRequestVO.getRadius() != null) {
            tdrRequestVO.setRadius(tdrRequestVO.getRadius() * 1000);
        }
        return porMapService.getDronePoiList(tdrRequestVO);
    }
}
