package com.its.api.its.controller.statistics;

import com.its.api.its.model.dto.statistics.FcltSttsStatErrorDto;
import com.its.api.its.model.dto.statistics.FcltSttsStatTypeDto;
import com.its.api.its.service.statistics.FcltSttsStatisticsService;
import io.swagger.annotations.*;
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/statistics/fclt-stts")
@Api(tags = "03.통계-5.시설물통신단절통계")
public class FcltSttsStatisticsController {

    private final FcltSttsStatisticsService service;

    @ApiOperation(value = "0.시설물 구분목록", response = FcltSttsStatTypeDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/type", produces = {"application/json; charset=utf8"})
    public List<FcltSttsStatTypeDto> findAll() {
        return this.service.findAllFcltSttsType();
    }

    @ApiOperation(value = "1.통신단절통계조회", response = FcltSttsStatErrorDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<FcltSttsStatErrorDto> findAllLink15MTerm(
            @ApiParam(name = "FCLT_CD", value = "시설물 구분코드(CCTV, VMS, VDS, ...)", example = "CCTV", required = true)
            @RequestParam String FCLT_CD,
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152059", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllFcltStts(FCLT_CD, FROM_DT, TO_DT);
    }

}
