package com.its.op.controller.its.rse;

import com.its.op.dto.its.rse.RseOdStatDto;
import com.its.op.dto.its.rse.RseOdStatListDto;
import com.its.op.service.its.rse.TbRseOdStatHhService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "14.RSE-3.통계조회-RSE OD 교통량 통계")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/tb_rse_od_stat_hh")
public class TbRseOdStatHhController {

    private final TbRseOdStatHhService service;

    @ApiOperation(value = "RSE OD 교통량 조회(출발/도착)", response = RseOdStatDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/tfvl/od", produces = {"application/json; charset=utf8"})
    public List<RseOdStatDto> findAllOdListByDateRange(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220122000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220122235959", required = true)
            @RequestParam String TO_DT) {
        return this.service.findAllOdListByDateRange(FROM_DT, TO_DT);
    }

    @ApiOperation(value = "RSE OD 교통량 목록 조회(출발-도착 목록)", response = RseOdStatListDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/tfvl/od-list", produces = {"application/json; charset=utf8"})
    public List<RseOdStatListDto> findAllListByDateRange(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220122000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220122235959", required = true)
            @RequestParam String TO_DT) {
        return this.service.findAllListByDateRange(FROM_DT, TO_DT);
    }

}
