package cn.axzo.msg.center.notices.integration.support;

import cn.axzo.msg.center.notices.integration.dto.request.BaseSmsRequest;
import cn.axzo.msg.center.notices.integration.dto.request.MessageRequest;
import cn.axzo.msg.center.notices.integration.dto.request.SmsCommonRequest;
import cn.axzo.msg.center.notices.integration.dto.request.SmsVariableRequest;

/**
 * 创蓝短信请求解析抽象类
 *
 * @author zhaoyong
 * @see AbstractChuangLanMessageRequestResolver
 * @since 2021-08-07 18:07
 */
public abstract class AbstractChuangLanMessageRequestResolver implements ChuangLanMessageRequestResolver {

  public BaseSmsRequest getBaseSmsRequest(MessageRequest request){
    if(request.isHasParam()) {
      SmsVariableRequest result = new SmsVariableRequest();
      result.setUid(request.getRequestChannelNo());
      result.setParams(request.getSmsContent());
      return result;
    } else {
      SmsCommonRequest result = new SmsCommonRequest();
      result.setUid(request.getRequestChannelNo());
      result.setPhone(request.getSmsContent());
      return result;
    }
  }

}
