/**
 * date : 2022. 4. 25.
 * auth : ckr
 * desc : 리스크 관리    
 */
package kr.co.uplus.ez.api.riskMgt;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import kr.co.uplus.ez.api.riskMgt.dto.*;
import kr.co.uplus.ez.common.components.ValidComponents;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

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

@RestController
@RequestMapping(value = "api/v1/bo/riskMgt")
public class RistMgtController {

	@Autowired
	RiskMgtService riskService;

	@Autowired
	ValidComponents validComponents;

	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발신번호 차단 목록 조회
	 *
	 * @param paramMap
	 * @return
	 * @
	 */
	@ApiOperation(value = "/sendNum/intrcpList", notes = "발신번호 차단 목록 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/sendNum/intrcpList", method = {RequestMethod.POST})
	@ResponseBody
	public SendNumIntrcpListResDto sendNumIntrcpList(@RequestBody @Valid SendNumIntrcpListReqDto sendNumIntrcpListReqDto, BindingResult bindingResult)  {
		if(validComponents.validParameter(bindingResult)) {
			return new SendNumIntrcpListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.sendNumIntrcpList(sendNumIntrcpListReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발신번호 차단 상세 정보 조회
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/sendNum/intrcpDetail", notes = "발신번호 차단 상세 정보 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/sendNum/intrcpDetail" , method = {RequestMethod.POST})
	@ResponseBody
	public SendNumIntrcpDetailResDto sendNumIntrcpDetail(@RequestBody @Valid SendNumIntrcpDetailReqDto sendNumIntrcpDetailReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new SendNumIntrcpDetailResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.sendNumIntrcpDetail(sendNumIntrcpDetailReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발신번호 차단 신규 등록
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/sendNum/insertIntrcp", notes = "발신번호 차단 신규 등록")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/sendNum/insertIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public SendNumInsertIntrcpResDto sendNumInsertIntrcp(@RequestBody @Valid SendNumInsertIntrcpReqDto insertIntrcpReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new SendNumInsertIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.sendNumInsertIntrcp(insertIntrcpReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발신번호 차단 수정 
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/sendNum/updateIntrcp", notes = "발신번호 차단 수정 ")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/sendNum/updateIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public SendNumUpdateIntrcpResDto sendNumUpdateIntrcp(@RequestBody @Valid SendNumUpdateIntrcplReqDto sendNumUpdateIntrcplReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new SendNumUpdateIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.sendNumUpdateIntrcp(sendNumUpdateIntrcplReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 발신번호 차단 삭제 
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/sendNum/deleteIntrcp", notes = "발신번호 차단 삭제 ")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/sendNum/deleteIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public SendNumDeleteIntrcpResDto sendNumDeleteIntrcp(@RequestBody @Valid SendNumDeleteIntrcpReqDto sendNumDeleteIntrcpReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new SendNumDeleteIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.sendNumDeleteIntrcp(sendNumDeleteIntrcpReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 080수신번호 차단 목록 조회 
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/zezNum/intrcpList", notes = "080수신번호 차단 목록 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/zezNum/intrcpList" , method = {RequestMethod.POST})
	@ResponseBody
	public ZezNumIntrcpListResDto zezNumIntrcpList(@RequestBody @Valid ZezNumIntrcpListReqDto zezNumIntrcpListReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new ZezNumIntrcpListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.zezNumIntrcpList(zezNumIntrcpListReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 메시지 차단 목록 조회
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/msg/intrcpList", notes = "메시지 차단 목록 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/msg/intrcpList" , method = {RequestMethod.POST})
	@ResponseBody
	public MsgIntrcpListResDto msgIntrcpList(@RequestBody @Valid MsgIntrcpListReqDto msgNumIntrcpListReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new MsgIntrcpListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.msgIntrcpList(msgNumIntrcpListReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 메시지 차단 상세 정보 조회
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/msg/intrcpDetail", notes = "메시지 차단 상세 정보 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/msg/intrcpDetail" , method = {RequestMethod.POST})
	@ResponseBody
	public MsgIntrcpDetailResDto msgIntrcpDetail(@RequestBody @Valid MsgIntrcpDetailReqDto msgIntrcpDetailReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new MsgIntrcpDetailResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.msgIntrcpDetail(msgIntrcpDetailReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 메시지 차단 신규 등록
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/msg/insertIntrcp", notes = "메시지 차단 신규 등록")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/msg/insertIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public MsgInsertIntrcpResDto msgInsertIntrcp(@RequestBody @Valid MsgInsertIntrcpReqDto msgInsertIntrcpReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new MsgInsertIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.msgInsertIntrcp(msgInsertIntrcpReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 메시지 차단 수정
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/msg/updateIntrcp", notes = "메시지 차단 수정")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/msg/updateIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public MsgUpdateIntrcpResDto msgUpdateIntrcp(@RequestBody @Valid MsgUpdateIntrcplReqDto msgUpdateIntrcplReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new MsgUpdateIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.msgUpdateIntrcp(msgUpdateIntrcplReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 메시지 차단 삭제
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/msg/deleteIntrcp", notes = "메시지 차단 삭제")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/msg/deleteIntrcp" , method = {RequestMethod.POST})
	@ResponseBody
	public MsgDeleteIntrcpResDto msgDeleteIntrcp(@RequestBody @Valid MsgDeleteIntrcpReqDto msgDeleteIntrcpReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new MsgDeleteIntrcpResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.msgDeleteIntrcp(msgDeleteIntrcpReqDto);
	}
	
	/**
	 * date : 2022. 4. 25.
	 * auth : ckr
	 * desc : 웹발송 차단 내역 목록 조회
	 * @param paramMap
	 * @return
	 * @  
	 */
	@ApiOperation(value = "/web/intrcpList", notes = "웹발송 차단 내역 목록 조회")
	@ApiResponses({
			@ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS")
	})
	@RequestMapping(value = "/web/intrcpList" , method = {RequestMethod.POST})
	@ResponseBody
	public WebIntrcpListResDto webIntrcpList(@RequestBody @Valid WebInsertIntrcpReqDto webInsertIntrcpReqDto, BindingResult bindingResult) {
		if(validComponents.validParameter(bindingResult)) {
			return new WebIntrcpListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
		}
		return riskService.webIntrcpList(webInsertIntrcpReqDto);
	}
}
