package com.its.op.controller.its.scrs;

import com.its.op.dto.its.scrs.ScStrtDto;
import com.its.op.service.its.scrs.ScStrtStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.RestController;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/scrs/statistics/strt")
@Api(tags = "14.스마트교차로-2.통계-3.교차로 주기수집 이력(포화도)")
public class ScStrtStatisticsController {

    private final ScStrtStatisticsService service;

    @ApiOperation(value = "포화도 수집 이력", response = ScStrtDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/clct-hs", produces = {"application/json; charset=utf8"})
    public List<ScStrtDto> findStrtClctHs(
            @ApiParam(name = "ixrIds", value = "교차로 목록", example = "[11,12]", required = true)
            @RequestParam List<String> ixrIds,
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH240000)", example = "20210112150000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH245959)", example = "20221112155959", required = true)
            @RequestParam String TO_DT) {
        return this.service.findStrtClctHs(ixrIds, FROM_DT, TO_DT);
    }

    @ApiOperation(value = "포화도 수집 이력-차로별", response = ScStrtDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/clct-lane-hs", produces = {"application/json; charset=utf8"})
    public List<ScStrtDto> findStrtClctLaneHs(
            @ApiParam(name = "ixrIds", value = "교차로 목록", example = "[11,12]", required = true)
            @RequestParam List<String> ixrIds,
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH240000)", example = "20210112150000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH245959)", example = "20221112155959", required = true)
            @RequestParam String TO_DT) {
        return this.service.findStrtClctLaneHs(ixrIds, FROM_DT, TO_DT);
    }

}
