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

import com.its.op.dto.its.ifsc.TbReptCngsSectTrafDto;
import com.its.op.dto.its.incident.TbIncdEstmSectDto;
import com.its.op.dto.its.incident.TbIncdOcrrDto;
import com.its.op.dto.its.link.TbLinkTrafDto;
import com.its.op.service.its.ifsc.TbReptCngsSectService;
import com.its.op.service.its.incident.TbIncdEstmSectService;
import com.its.op.service.its.incident.TbIncdOcrrService;
import com.its.op.service.its.link.TbLinkTrafService;
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.메인-3.시스템 운영 정보")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/manage/main/syst-opr")
public class SystOprController {

    private final TbIncdOcrrService incdOcrrService;
    private final TbReptCngsSectService reptCngsSectService;
    private final TbLinkTrafService linkTrafService;
    private final TbIncdEstmSectService incdAutoService;

    @ApiOperation(value = "돌발상황정보(TB_INCD_OCRR)", response = TbIncdOcrrDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/incd-ocrr", produces = {"application/json; charset=utf8"})
    public List<TbIncdOcrrDto> findIncdOcrrAll() {
        return this.incdOcrrService.findAllProgress();
    }

    @ApiOperation(value = "시스템 자동돌발상황정보(TB_INCD_ESTM_SECT)", response = TbIncdEstmSectDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/auto-incd", produces = {"application/json; charset=utf8"})
    public List<TbIncdEstmSectDto> findAll() {
        return incdAutoService.findAll();
    }

    @ApiOperation(value = "반복정체구간(TB_REPT_CNGS_SECT, TB_IFSC, TB_IFSC_TRAF)", response = TbReptCngsSectTrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/repeat-congest", produces = {"application/json; charset=utf8"})
    public List<TbReptCngsSectTrafDto> findCurrentReptCngsSectAll() {
        return this.reptCngsSectService.findAllCurrentTraf();
    }

    @ApiOperation(value = "소통정보결측구간(TB_LINK_TRAF, TB_LINK)", response = TbLinkTrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/miss-link-traf", produces = {"application/json; charset=utf8"})
    public List<TbLinkTrafDto> findMissingLinkTrafAll() {
        return this.linkTrafService.findAllMissTraf();
    }

}
