package sgc.portal.cs.cspop.web;

import org.springframework.web.bind.annotation.*;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.cs.cspop.dto.CSPOPSearch;
import sgc.portal.cs.cspop.model.CSPOPVo;
import sgc.portal.cs.cspop.model.CSTcsSiteTradeChrgrVo;
import sgc.portal.cs.cspop.service.CSPOPService;

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

@RestController
@RequestMapping("/cs/cspop")
public class CSPOPController {
    private final CSPOPService service;

    public CSPOPController(CSPOPService service) {
        this.service = service;
    }
    
    @PostMapping("/CSPOP/siteList")
    public List<EasyHashMap<String, Object>> getSiteList(@RequestBody CSPOPSearch search) {
        return service.getSiteList(search);
    }
    
    @PostMapping("/CSPOP/siteAllList")
    public List<EasyHashMap<String, Object>> getSiteAllList(@RequestBody CSPOPSearch search) {
        return service.getSiteAllList(search);
    }
    
    @PostMapping("/CSPOP/searchProd")
    public List<EasyHashMap<String, Object>> getProdList(@RequestBody CSPOPSearch search) {
        return service.getProdList(search);
    }
    
    @PostMapping("/CSPOP/vendList")
    public List<EasyHashMap<String, Object>> getVendList(@RequestBody CSPOPSearch search) {
        return service.getVendList(search);
    }
    
    @PostMapping("/CSPOP/getSmsList")
    public List<EasyHashMap<String, Object>> getSmsList(@RequestBody CSPOPSearch search) {
        return service.getSmsList(search);
    }
    
    @PostMapping("/CSPOP/sendSms")
    public Map<String, String> sendSms(@RequestBody CSPOPVo CSPOPVo) {
        return service.sendSms(CSPOPVo);
    }
    
    @PostMapping("/CSPOP/sendSmsM")
    public Map<String, String> sendSmsM(@RequestBody List<CSPOPVo> CSPOPVo) {
        return service.sendSmsM(CSPOPVo);
    }
    
    @PostMapping("/CSPOP/empPopLst")
    public List<EasyHashMap<String, Object>> getEmpPopLst(@RequestBody CSPOPSearch search) {
        return service.getEmpPopLst(search);
    }
    
    @PostMapping("/CSPOP/selectGuarIntuNmList")
    public List<EasyHashMap<String, Object>> selectGuarIntuNmList(@RequestBody CSPOPSearch search) {
        return service.selectGuarIntuNmList(search);
    }
    
    @PostMapping("/CSPOP/selectSiteCovendList")
    public List<EasyHashMap<String, Object>> selectSiteCovendList(@RequestBody CSPOPSearch search) {
        return service.selectSiteCovendList(search);
    }
    
    @PostMapping("/CSPOP/selectTcsSiteTradeItemPopList")
    public List<EasyHashMap<String, Object>> selectTcsSiteTradeItemPopList(@RequestBody CSPOPSearch search) {
        return service.selectTcsSiteTradeItemPopList(search);
    }
    
    @PostMapping("/CSPOP/selectCovendPopList")
    public List<EasyHashMap<String, Object>> selectCovendPopList(@RequestBody CSPOPSearch search) {
        return service.selectCovendPopList(search);
    }
    
    @PostMapping("/CSPOP/selectCommonPopSmComCovendList")
    public EasyHashMap<String, Object> selectCommonPopSmComCovendList(@RequestBody CSPOPSearch search) {
        return service.selectCommonPopSmComCovendList(search);
    }
    
    @PostMapping("/CSPOP/selectCommonPopTcsSiteTradeList")
    public List<EasyHashMap<String, Object>> selectCommonPopTcsSiteTradeList(@RequestBody CSPOPSearch search) {
        return service.selectCommonPopTcsSiteTradeList(search);
    }
    
    @PostMapping("/CSPOP/selectCommonPopTcsSiteTradeGuarList")
    public List<EasyHashMap<String, Object>> selectCommonPopTcsSiteTradeGuarList(@RequestBody CSPOPSearch search) {
        return service.selectCommonPopTcsSiteTradeGuarList(search);
    }
    
    @PostMapping("/CSPOP/selectCommonPopSmComCovendChrgrList")
    public Map<String, Object> selectCommonPopSmComCovendChrgrList(@RequestBody CSPOPSearch search) {
    	
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	
    	List<EasyHashMap<String, Object>> list1 = service.selectCommonPopSmComCovendChrgrList(search);
    	int count21 = service.selectSmComCovendAS1(search);
    	int count22 = service.selectSmComCovendAS2(search);
    	int count23 = service.selectSmComCovendAS3(search);
    	
    	resultMap.put("dcdataList3"					, list1);
    	resultMap.put("dcdataList3Count1"			, count21);
    	resultMap.put("dcdataList3Count2"			, count22);
    	resultMap.put("dcdataList3Count3"			, count23);
    	
        return resultMap;
    }
    
    @PostMapping("/CSPOP/updateSmComCovendChrgrPop")
    public  Map<String, String> updateSmComCovendChrgrPop(@RequestBody CSTcsSiteTradeChrgrVo cSTcsSiteTradeChrgrVo) {
        return service.updateSmComCovendChrgrPop(cSTcsSiteTradeChrgrVo);
    }
}
