package com.its.web.controller.traffic;

import com.its.web.dto.message.ResultDto;
import com.its.web.dto.traffic.IntersectionDto;
import com.its.web.service.traffic.IntersectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Profile("itcs")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/itcs")
@Api(tags = "01-2.교통정보 - 스마트교차로")
public class IntersectionController {
    private final IntersectionService service;

    @ApiOperation(value = "01.스마트 교차로 리스트 조회(IXR_MNGM)", response = IntersectionDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "/list", produces = {"application/json; charset=utf8"})
    @ResponseBody
    public List<IntersectionDto> findIntersectionList() {
        return service.findIntersectionList();
    }

    @ApiOperation(value = "01.스마트 교차로 전체 리스트 조회(IXR_MNGM)", response = IntersectionDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "/list-all", produces = {"application/json; charset=utf8"})
    @ResponseBody
    public List<IntersectionDto> findAllIntersectionList() {
        return service.findAllIntersection();
    }

    @ApiOperation(value = "02.스마트 교차로 카메라 홈페이지 표출 여부 설정")
    @PostMapping(value = "/hmpg-stts-update", produces = {"application/json; charset=utf8"})
    @ResponseBody
    public ResultDto updateCctvHmpgUseYn(@RequestParam Map<String, Object> paramMap) {
        return this.service.updateCctvHmpgUseYn(paramMap);
    }
}
