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 SendCustomMsgService {

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

    @Data
    class SendCustomMsgRequest {
        String  templateId;  //模板Id
        String  params;      //模版参数(JSON格式)
        String  creater; 	    //创建人（不传入时默认系统管理员）
        String  receiver; 	//接收人  多个，分割
        String  pcLinkUrl; 	//pc链接
        String  mobileUrl; 	//移动端链接
        String  targetId; 	//消息来源code+”|”+业务id需要修改消息状态时传入
        String  bizState; 	 //0 表示消息初始状态是待处理 需要修改消息状态时传入
    }

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

}
