package com.bizzan.bitrade.model.update;

import lombok.Data;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import com.bizzan.bitrade.ability.UpdateAbility;
import com.bizzan.bitrade.constant.Platform;
import com.bizzan.bitrade.entity.AppRevision;

/**
 * @author
 * @Title: ${file_name}
 * @Description:
 * @date 2019/4/2416:48
 */
@Data
public class AppRevisionUpdate implements UpdateAbility<AppRevision> {

    private String remark;

    private String version;

    private String downloadUrl;

    private Platform platform;
    
    private String lowestVersion;
    
    private String updateDescription;
    //转化
    @Override
    public AppRevision transformation(AppRevision appRevision) {
        if (StringUtils.isNotBlank(remark)) {
            appRevision.setRemark(remark);
        }
        if (StringUtils.isNotBlank(version)) {
            appRevision.setVersion(version);
        }
        if (StringUtils.isNotBlank(downloadUrl)) {
            appRevision.setDownloadUrl(downloadUrl);
        }
        if (platform != null) {
            appRevision.setPlatform(platform);
        }
        appRevision.setLowestVersion(lowestVersion);
        appRevision.setUpdateDescription(updateDescription);
        appRevision.setPublishTime(new Date());
        return appRevision;
    }


}
