package com.its.api.its.controller.report;

import com.its.api.its.model.dto.report.ReportFacilityErrorDto;
import com.its.api.its.model.dto.report.ReportFacilitySummaryDto;
import com.its.api.its.model.dto.report.ReportTrafficCongestDto;
import com.its.api.its.model.dto.report.ReportTrafficIncidentDto;
import com.its.api.its.service.report.ReportService;
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/report/report")
@Api(tags = "05.보고서-1.보고서")
public class ReportController {

    private final ReportService service;

    @ApiOperation(value = "시설물보고서-시설물 현황", response = ReportFacilitySummaryDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/facility/summary", produces = {"application/json; charset=utf8"})
    public List<ReportFacilitySummaryDto> findAllFacilitySummary(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220302000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220302235959", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllFacilitySummary(FROM_DT, TO_DT);
    }
/*
    @ApiOperation(value = "시설물보고서-시설물 현황", response = ReportFacilitySummaryDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/facility/summary2", produces = {"application/json; charset=utf8"})
    public List<ReportFacilitySummaryDto> findAllFacilitySummary2(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220327000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220327235959", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllReportFacilitySummary(FROM_DT, TO_DT);
    }*/

    @ApiOperation(value = "시설물보고서-장애 현황", response = ReportFacilityErrorDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/facility/error", produces = {"application/json; charset=utf8"})
    public List<ReportFacilityErrorDto> findAllFacilityError(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220302000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220302235959", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllFacilityError(FROM_DT, TO_DT);
    }

    @ApiOperation(value = "교통보고서-지/정체 현황", response = ReportTrafficCongestDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/traffic/congest", produces = {"application/json; charset=utf8"})
    public List<ReportTrafficCongestDto> findAllTrafficCongest(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220127000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220127235959", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllTrafficCongest(FROM_DT, TO_DT);
    }

    @ApiOperation(value = "교통보고서-돌발 현황", response = ReportTrafficIncidentDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/traffic/incident", produces = {"application/json; charset=utf8"})
    public List<ReportTrafficIncidentDto> findAllTrafficIncident(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220127000000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220127235959", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllTrafficIncident(FROM_DT, TO_DT);
    }

}
