package com.red.circle.other.app.convertor.sys;

import com.red.circle.framework.core.convertor.ConvertorModel;
import com.red.circle.other.app.dto.cmd.sys.SysFeedbackUploadCmd;
import com.red.circle.other.infra.database.rds.entity.sys.SysFeedback;
import org.mapstruct.Mapper;

/**
 * @author pengliang
 * @since 2019/10/28 17:25
 */
@Mapper(componentModel = ConvertorModel.SPRING)
public interface FeedbackAppConvertor {

  default SysFeedback toFeedback(SysFeedbackUploadCmd cmd) {
    SysFeedback feedback = new SysFeedback();
    feedback.setUserId(cmd.getReqUserId());
    feedback.setContent(cmd.getContent());
    feedback.setImageUrls(cmd.getImageUrls());
    feedback.setVideoUrls(cmd.getVideoUrls());
    feedback.setAppVersion(cmd.getReqAppIntel().getVersion());
    feedback.setSysOrigin(cmd.requireReqSysOrigin());
    feedback.setImei(cmd.getReqImei());
    feedback.setIp(cmd.getReqIp());
    feedback.setPhoneModel(cmd.getReqAppIntel().getModel());
    return feedback;
  }
}
