package cn.axzo.msg.center.notices.manager.api.dto.request;

import cn.axzo.msg.center.api.request.ExpansionInfo;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Map;

/**
 * 发送消息请求
 * @Author: LiuYang
 * @Date: 2021/5/20 18:12
 */
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Setter
@Getter
public class MnsRequestDto extends ExpansionInfo {

  /**
   * 请求号
   */
  private String requestNo;

  /**
   * 接入码
   */
  private String appCode;

  /**
   * 短信模板号
   */
  private String templateNo;

  /**
   * 电话号码
   */
  private String phoneNo;

  /**
   * 参数
   */
  private Map<String, Object> params;

  private Object internalObj;

  public <T> T getInternalObj(Class<T> clazz) {
      return clazz.isInstance(internalObj) ? clazz.cast(internalObj) : null;
  }

  @Override
  public String toString() {
    return JSON.toJSONString(this);
  }
}
