package cn.axzo.msg.center.notices.manager.converter;

import cn.axzo.msg.center.notices.integration.dto.response.ChuangLanSmsResponse;
import cn.axzo.msg.center.notices.manager.api.dto.response.BatchMessageSendResponseDto;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * DTO -> VO
 *
 * @author zhaoyong
 * @see ChuangLanSmsResponseDtoToVoConverter
 * @since 2021-08-07 20:32
 */
@Component
public class ChuangLanSmsResponseDtoToVoConverter implements Converter<ChuangLanSmsResponse, BatchMessageSendResponseDto> {

  @Override
  public BatchMessageSendResponseDto convert(ChuangLanSmsResponse source) {
    Assert.notNull(source, "source must not be null");
    BatchMessageSendResponseDto response = new BatchMessageSendResponseDto();
    response.setCode(source.getCode());
    response.setErrorMsg(source.getErrorMsg());
    response.setSuccessNum(source.getSuccessNum());
    response.setFailNum(source.getFailNum());
    response.setMsgId(source.getMsgId());
    response.setTime(source.getTime());
    return response;
  }
}
