/**
 * date : 2022. 4. 25.
 * auth : ckr
 * desc : 모니터링
 */
package kr.co.uplus.ez.api.mntrng;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import kr.co.uplus.ez.common.components.ValidComponents;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ApiResponseMessage;

import kr.co.uplus.ez.api.mntrng.dto.SendListResDto;
import kr.co.uplus.ez.api.mntrng.dto.SendListReqDto;
import kr.co.uplus.ez.api.mntrng.dto.LiveSendSttusReqDto;
import kr.co.uplus.ez.api.mntrng.dto.LiveSendSttusResDto;

@RestController
@RequestMapping(value = "api/v1/bo/mntrng")
public class MntrngController {
	@Autowired
	MntrngService mntrngService;

	@Autowired
	ValidComponents validComponents;

	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발송내역 목록 조회
	 * @param paramMap
	 * @throws Exception
	 */
	@ApiOperation(value = "sendList", notes = "발송내역 목록 조회")
	@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
	@RequestMapping(value = "/sendList" , method = {RequestMethod.POST})
	@ResponseBody
	public SendListResDto sendList(@RequestBody @Valid SendListReqDto sendListReqDto, BindingResult bindingResult) {
		if (validComponents.validParameter(bindingResult)) {
			return new SendListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return mntrngService.sendList(sendListReqDto);
	}

	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 실시간 발송 현황 정보 조회
	 * @param paramMap
	 * @throws Exception
	 */
	@ApiOperation(value = "liveSendSttus", notes = "실시간 발송 현황 정보 조회")
	@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
	@RequestMapping(value = "/liveSendSttus" , method = {RequestMethod.POST})
	@ResponseBody
	public LiveSendSttusResDto liveSendSttus() {
		return mntrngService.liveSendSttus();
	}
}
