package com.tsi.monitoring.controller;

import com.tsi.monitoring.service.SectionService;
import com.tsi.monitoring.service.UtisService;
import com.tsi.monitoring.vo.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/api/statistics")
public class StatisticsController {
    private final UtisService utisService;
    private final SectionService sectionService;

    @PostMapping("/getPeriodRcvIncdHistory")
    @ResponseBody
    public List<RcvIncdMoctVo> getPeriodRcvIncdHistory(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodRcvIncdHistory(paramMap);
    }

    @PostMapping("/getPeriodCenterRcvSendStatistics")
    @ResponseBody
    public List<PeriodCenterRcvSendStatisticsVo> getPeriodCenterRcvSendStatistics(@RequestBody Map<String, Object> paramMap) {
//        return this.sectionService.getPeriodCenterRcvSendStatistics(paramMap);
        return this.utisService.getPeriodCenterRcvSendStatistics(paramMap);
    }

    @PostMapping("/getCenterSendRecCount")
    @ResponseBody
    public List<CenterSendRecCountVo> getCenterSendRecCount(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getCenterSendRecCount(paramMap);
    }

    @PostMapping("/getPeriodRcvNtsStatistics")
    @ResponseBody
    public List<SendRcvHistVo> getPeriodRcvNtsStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodRcvNtsStatistics(paramMap);
    }

    @PostMapping("/getPeriodSndMoctStatistics")
    @ResponseBody
    public List<SndMoctVo> getPeriodSndMoctStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodSndMoctStatistics(paramMap);
    }

    @PostMapping("/getPeriodSndMolitTraffStatistics")
    @ResponseBody
    public List<SndMolitTraffVo> getPeriodSndMolitTraffStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodSndMolitTraffStatistics(paramMap);
    }

    @PostMapping("/getPeriodRcvMolitTraffStatistics")
    @ResponseBody
    public List<SndMolitTraffVo> getPeriodRcvMolitTraffStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodRcvMolitTraffStatistics(paramMap);
    }

    @PostMapping("/getPeriodRcvMoctTraffStatistics")
    @ResponseBody
    public List<SndMolitTraffVo> getPeriodRcvMoctTraffStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodRcvMoctTraffStatistics(paramMap);
    }

    @PostMapping("/getPeriodSigCommStatistics")
    @ResponseBody
    public List<SigCommStatisticsVo> getPeriodSigCommStatistics(@RequestBody Map<String, Object> paramMap) {
        return this.utisService.getPeriodSigCommStatistics(paramMap);
    }
}
