package com.persagy.dmp.rwd.version.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.persagy.dmp.common.lang.PsDateTime;
import com.persagy.dmp.common.model.entity.AuditableEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * 对象数据
 * @author Charlie Yu
 * @date 2021-06-25
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dt_relation_his", autoResultMap = true)
public class ObjectRelationHistory extends AuditableEntity {

    public static final String OBJ_FROM="obj_from";
    public static final String OBJ_TO="obj_to";
    public static final String REL_CODE_HUM="relCode";
    public static final String OBJ_FROM_HUM="objFrom";
    public static final String OBJ_TO_HUM="objTo";
    public static final String RELATION_TO_HUM="relationTo";
    public static final String RELATION_FROM_HUM="relationFrom";
    public static final String GRAPH_CODE_HUM="graphCode";
    public static final String REL_VALUE_HUM="relValue";

    /** 项目ID */
    private String projectId;
    /** 集团编码 */
    private String groupCode;

    /** 关系id */
    private String relId;
    /** 图例ID */
    @Length(max = 40)
    private String graphId;
    /** 图例编码 */
    @NotNull(message = "图例编码不允许为空")
    @Length(max = 40)
    private String graphCode;
    /** 关系编码 */
    @NotNull(message = "关系编码不允许为空")
    @Length(max = 40)
    private String relCode;
    /** 关系值 */
    private String relValue;
    /** 来源对象 */
    @NotNull(message = "来源对象不允许为空")
    private String objFrom;
    /** 目标对象 */
    @NotNull(message = "目标对象不允许为空")
    private String objTo;
    /** 创建应用 */
    private String createApp;
    /** 最后修改应用 */
    private String updateApp;
    /** 对象的outline平面坐标 */
    @TableField(exist = false,typeHandler = JacksonTypeHandler.class,value = "outLines")
    private List<LinkedHashMap<String,Object>> outLines;
    /** 统计数 */
    @TableField(exist = false)
    private Integer count;

    /** 最新标示 */
    private Boolean lastFlag;

    /** 版本创建时间 */
    private PsDateTime startTime;

    /** 版本结束时间 */
    private PsDateTime endTime;
}
