package com.its.api.its.controller.analysis;

import com.its.api.its.model.dto.ifsc.TbReptCngsSectDto;
import com.its.api.its.service.ifsc.TbReptCngsSectService;
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/analysis/rept-cngs")
@Api(tags = "04.분석-6.반복정체구간분석")
public class TbReptCngsSectAnalController {

    private final TbReptCngsSectService service;

    @ApiOperation(value = "반복정체 요일구분 목록 조회(TB_CMMN_CD)", response = TbReptCngsSectDto.ReptCngsDayType.class, responseContainer = "ArrayList")
    @GetMapping(value = "/day-type", produces = {"application/json; charset=utf8"})
    public List<TbReptCngsSectDto.ReptCngsDayType> findAllDayType() {
        return this.service.findAllDayType();
    }

    @ApiOperation(value = "반복정체구간분석(TB_REPT_CNGS_SECT, TB_IFSC)", response = TbReptCngsSectDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbReptCngsSectDto> findAllAnalByDayTypeCdAndStatYm(
            @ApiParam(name = "DAY_TYPE_CD", value = "요일유형(ALL(전체), DTW1(월), DTW2(화), DTW3(수), DTW4(목), DTW5(금), DTW6(토), DTW7(일))", example = "ALL", required = true)
            @RequestParam String DAY_TYPE_CD,
            @ApiParam(name = "BASE_MN", value = "기준월(YYYYMM)", example = "202202", required = true)
            @RequestParam String BASE_MN) {

        return this.service.findAllAnalByDayTypeCdAndStatYm(DAY_TYPE_CD, BASE_MN);
    }

}
