package cn.ey.biz.module.weaver.api.msg;

import cn.ey.biz.module.weaver.autoconfigure.FeignConfiguration;
import cn.ey.biz.module.weaver.common.Constants;
import lombok.Data;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 短信发送
 *
 */
@FeignClient(name= Constants.WEAVER_NAME, url="${weaver.service.url}", configuration = FeignConfiguration.class)
public interface SendSmsService {

    @RequestMapping(method= RequestMethod.POST, value="/api/ey/msgcenter/sendSms",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.TEXT_PLAIN_VALUE)
    SendSmsResponse sendSms(@RequestBody SendSmsRequest request);

    @Data
    class SendSmsRequest {
        String   templateId;  //模板Id
        String   params;      //模版参数(JSON格式)
        String   mobile;     //手机号
    }

    @Data
    class SendSmsResponse{
        Boolean api_status;
        String api_msg;
    }

}
