package cn.axzo.msg.center.api;

import cn.axzo.msg.center.api.request.*;
import cn.axzo.msg.center.api.response.MnsCodeStatusRes;
import cn.axzo.msg.center.api.response.MnsQueryTemplateRes;
import cn.axzo.msg.center.api.response.MnsSendCodeRes;
import cn.axzo.msg.center.api.response.Page;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * 短信消息相关接口
 */
@FeignClient(name = "msg-center", url = "${server.serviceUrl:http://msg-center:8080}")
public interface MNSNoticesApi {

    /**
     *  发送短信消息
     * @param request
     * @return
     */
    @PostMapping("mns/send/sms")
    CommonResponse<Void> sendMessage(@RequestBody @Valid SendMessageRequestDto request);

    /**
     * 发送验证码2.0(返回的是数字）
     * @param req
     * @return
     */
    @PostMapping("webApi/sms/v2/code")
    CommonResponse<MnsSendCodeRes> sendCodeV2(@Validated @RequestBody MnsSendCodeV2Req req);

    /**
     * 获取验证码状态
     * @param req
     * @return
     */
    @PostMapping("webApi/sms/code/status")
    CommonResponse<MnsCodeStatusRes> getPhoneCodeStatus(@Validated @RequestBody MnsCodeStatusReq req);

    /**
     *  新增模板
     * @param request
     * @return
     */
    @PostMapping("template/create")
    CommonResponse<Object> createTemplate(@RequestBody MnsCreateTemplateRequestReq request);

    /**
     * 根据模板编号查询模板信息
     * @param templateNo
     * @return
     */
    @GetMapping("template/getByTemplateNo/{templateNo}")
    CommonResponse<MnsQueryTemplateRes> getByTemplateNo(@PathVariable("templateNo") String templateNo);

    /**
     * 查询模板列表信息
     * @param request
     * @return
     */
    @PostMapping("template/list")
    CommonResponse<Page<MnsQueryTemplateRes>> list(@RequestBody MnsQueryTemplateReq request);

    /**
     * 删除模板信息
     * @param templateNo
     * @return
     */
    @GetMapping("template/delete/{templateNo}")
    CommonResponse<Object> delete(@PathVariable("templateNo") String templateNo);

}
