package cn.estsh.i3plus.pojo.mdm.bean.base;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MdmEnumUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @Description : 数据中心同步数据
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2020-06-02 16:14
 * @Modify:
 **/
@Data
@ApiModel("数据中心同步数据")
public class MdmSyncData implements Serializable {

    private static final long serialVersionUID = -1642626000860074060L;

    @ApiModelProperty("同步数据类型")
    @AnnoOutputColumn(refClass = MdmEnumUtil.MDM_SYNC_TYPE.class)
    private Integer syncType;

    public int getSyncTypeVal(){
        return syncType == null ? MdmEnumUtil.MDM_SYNC_TYPE.INSERT.getValue() : syncType;
    }

    public String getSyncTypeTxt(){
        return syncType == null ? "无":MdmEnumUtil.MDM_SYNC_TYPE.valueOfDescription(syncType);
    }

    @ApiModelProperty("同步模块")
    @AnnoOutputColumn(refClass = CommonEnumUtil.SOFT_TYPE.class)
    private Integer syncSoftType;

    public String getSyncSoftTypeTxt(){
        return syncSoftType == null ? "无":CommonEnumUtil.SOFT_TYPE.valueOfDescription(syncSoftType);
    }

    @ApiModelProperty("是否是主数据")
    @AnnoOutputColumn(refClass = CommonEnumUtil.TRUE_OR_FALSE.class)
    private Integer isMasterData;

    public int getIsMasterDataVal() {
        return isMasterData == null ? CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue() : isMasterData;
    }

    public String getIsMasterDataTxt(){
        return isMasterData == null ? "无":CommonEnumUtil.TRUE_OR_FALSE.valueOfDescription(isMasterData);
    }

    @ApiModelProperty("同步数据class")
    private String syncDataClass;

    public String getSyncDataClassSimpleName(){
        if(syncDataClass == null){
            return null;
        }

        return syncDataClass.trim().substring(syncDataClass.trim().lastIndexOf(".") + 1);
    }

    @ApiModelProperty("同步数据id")
    private List<Long> syncDataId;

    @ApiModelProperty("同步数据用户名")
    private String syncDateUserName;

    @ApiModelProperty("同步时间")
    private String syncDateTime;

    @ApiModelProperty("同步失败键")
    private String syncFailKey;

    @ApiModelProperty("同步失败时间")
    private String syncFailDateTime;

    @ApiModelProperty("同步失败信息")
    private String syncFailMessage;
}
