package cn.axzo.msg.center.notices.client.converters;


import cn.axzo.msg.center.notices.http.api.request.SendMobileMessageRequest;
import cn.axzo.msg.center.notices.manager.api.dto.request.MnsRequestDto;
import cn.hutool.core.lang.Assert;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * 发送消息请求对象 VO 转 dto
 *
 * @author zhaoyong_sh
 * @see SendMobileMessageRequestToDtoConverter
 * @since 2021-05-27 18:27
 */
@Component
public class SendMobileMessageRequestToDtoConverter implements
    Converter<SendMobileMessageRequest, MnsRequestDto> {

  @Override
  public MnsRequestDto convert(SendMobileMessageRequest source) {
    Assert.notNull(source, "source must not be null");
    MnsRequestDto dto = new MnsRequestDto();
    dto.setRequestNo(source.getRequestNo());
    dto.setAppCode(source.getAppCode());
    dto.setPhoneNo(source.getPhoneNo());
    dto.setTemplateNo(source.getTemplateNo());
    dto.setParams(source.getParams());
    dto.setExpansion(source.getExpansion());
    return dto;
  }

}
