package com.zanxiang.game.module.sdk.controller;

import com.zanxiang.game.module.sdk.pojo.param.SmsCheckParam;
import com.zanxiang.game.module.sdk.pojo.param.SmsSendParam;
import com.zanxiang.game.module.sdk.pojo.param.UserData;
import com.zanxiang.game.module.sdk.pojo.vo.UserLoginVO;
import com.zanxiang.game.module.sdk.service.ISmsService;
import com.zanxiang.module.util.pojo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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.RestController;

/**
 * @author : lingfeng
 * @time : 2022-06-16
 * @description : 短信服务接口
 */
@Api(tags = "短信服务接口")
@RestController
@RequestMapping(value = "/api/sms")
public class SmsController {

    @Autowired
    private ISmsService smsService;

    @ApiOperation(value = "发送短信")
    @PostMapping("/send/msg")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = UserLoginVO.class)})
    public ResultVO<Boolean> smsSend(@Validated @RequestBody SmsSendParam smsSendParam, UserData userData) {
        return smsService.smsSend(smsSendParam, userData);
    }

    @ApiOperation(value = "验证码校验")
    @PostMapping("/check/msg")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = UserLoginVO.class)})
    public ResultVO<Boolean> smsCheck(@Validated @RequestBody SmsCheckParam smsCheckParam) {
        return smsService.smsCheck(smsCheckParam);
    }
}
