package cn.ey.biz.module.system.api.sms;

import cn.ey.biz.common.pojo.R;
import cn.ey.biz.module.system.api.sms.dto.code.SmsCodeCheckReqDTO;
import cn.ey.biz.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
import cn.ey.biz.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
import cn.ey.biz.module.system.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

@FeignClient(name = ApiConstants.NAME)
@Api(tags = "RPC 服务 - 短信验证码")
public interface SmsCodeApi {

    String PREFIX = ApiConstants.PREFIX + "/oauth2/sms/code";

    @PostMapping(PREFIX + "/send")
    @ApiOperation("创建短信验证码，并进行发送")
    R<Boolean> sendSmsCode(@Valid @RequestBody SmsCodeSendReqDTO reqDTO);

    @PutMapping(PREFIX + "/use")
    @ApiOperation("验证短信验证码，并进行使用")
    R<Boolean> useSmsCode(@Valid @RequestBody SmsCodeUseReqDTO reqDTO);

    @GetMapping(PREFIX + "/check")
    @ApiOperation("检查验证码是否有效")
    R<Boolean> checkSmsCode(@Valid @RequestBody SmsCodeCheckReqDTO reqDTO);

}
