package com.its.op.controller.its.management;

import com.its.op.dto.its.common.TrafDto;
import com.its.op.service.its.ifsc.TbIfscTrafService;
import com.its.op.service.its.link.TbLinkTrafService;
import com.its.op.service.its.road.TbRoadTrafService;
import com.its.op.service.its.vms.TbVmsIfscTrafService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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;

@Api(tags = "00.교통상황관리-0.메인-4.현재소통정보")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/manage/main/traffic")
public class TrafController {

    /**
     * 현재 소통정보 조회, 기타 부가정보를 제외한 순수 소통정보 만 조회한다.
     */
    private final TbLinkTrafService linkTrafService;
    private final TbIfscTrafService ifscTrafService;
    private final TbRoadTrafService roadTrafService;
    private final TbVmsIfscTrafService vmsTrafService;

    @ApiOperation(value = "링크소통정보(TB_LINK_TRAF)", response = TrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/link", produces = {"application/json; charset=utf8"})
    public List<TrafDto> findAllTrafLink() {
        return this.linkTrafService.findAllTraf();
    }

    @ApiOperation(value = "정보제공구간소통정보(TB_IFSC_TRAF)", response = TrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/ifsc", produces = {"application/json; charset=utf8"})
    public List<TrafDto> findAllTrafIfsc() {
        return this.ifscTrafService.findAllTraf();
    }

    @ApiOperation(value = "도로소통정보(TB_ROAD_TRAF)", response = TrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/road", produces = {"application/json; charset=utf8"})
    public List<TrafDto> findAllTrafRoad() {
        return this.roadTrafService.findAllTraf();
    }

    @ApiOperation(value = "VMS정보제공구간소통정보(TB_VMS_CMTRINFR)", response = TrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/vms", produces = {"application/json; charset=utf8"})
    public List<TrafDto> findAllTrafVms() {
        return this.vmsTrafService.findAllTraf();
    }

}
