package com.icomsys.main_vm.biz.common.dashboard.controller;

import com.icomsys.main_vm.biz.rcp.statistics.dashboard.service.StatisticsDashboardService;
import com.icomsys.main_vm.db.mybatis.alias.StatisticsDashboardVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

@Controller
@RequiredArgsConstructor
@RequestMapping("/admin/common/dashboard")
@Slf4j
public class DashboardController {

    private final StatisticsDashboardService statisticsDashboardService;

    @GetMapping("/manage.do")
    public String DashboardView(){
        return "/adm/common/dashboard";
    }

    @RequestMapping(value = "/callinfolist.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public List<HashMap> selectStatCallInfoList(@RequestBody StatisticsDashboardVO vo) {
        List<HashMap> result = statisticsDashboardService.selectStatCallInfo(vo);

        return result;
    }

    @RequestMapping(value = "/intentlist.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public List<HashMap> selectStatIntentList(@RequestBody StatisticsDashboardVO vo) {
        List<HashMap> result = statisticsDashboardService.selectStatIntent(vo);

        return result;
    }

    @RequestMapping(value = "/scenariolist.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public List<HashMap> selectStatScenarioList(@RequestBody StatisticsDashboardVO vo) {
        List<HashMap> result = statisticsDashboardService.selectStatScenario(vo);

        return result;
    }

    @RequestMapping(value = "/callcntlist.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public List<HashMap> selectTodayCallCntList(@RequestBody StatisticsDashboardVO vo) {
        List<HashMap> result = statisticsDashboardService.selectCallCntByToday(vo);

        return result;
    }

    @RequestMapping(value = "/curcallcnt.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public int selectCurCallCnt(@RequestBody StatisticsDashboardVO vo) {
        int result = statisticsDashboardService.selectCurCallCnt(vo);

        return result;
    }

}
