package com.liangjian.dataplatform.member.entity.vo.datanodes;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liangjian.dataplatform.member.constant.DataNodeConstant;
import com.liangjian.dataplatform.member.entity.pojo.PkAndNullable;

import java.util.Date;

/**
 * @Author: 黄子奇
 * @Date: 2019/8/26 15:41
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class PDMColumn extends DataNode {
    private static final long serialVersionUID = 1512745355623465328L;

    /** 字段中文名称 */
    protected String cnName;

    /** 字段类型 */
    protected String type;

    /** 字段长度 */
    protected Integer length;

    /** 字段精度 */
    protected Integer prec;

    /** 字段信息结构，pk，nullable */
    protected PkAndNullable entry;

    public PDMColumn() {
    }

    public PDMColumn(String id, String prtId, String name, String bizDomain, String nodeType, Boolean isParent, String comment, String remark, Date crtDate, Date lastUpdate, String crtUser, String namespace, String cnName, String type, Integer length, Integer prec, PkAndNullable entry) {
        super(id, prtId, name, bizDomain, nodeType, isParent, comment, remark, crtDate, lastUpdate, crtUser, namespace);
        this.cnName = cnName;
        this.type = type;
        this.length = length;
        this.prec = prec;
        this.entry = entry;
    }

    @Override
    public String getDataKind() {
        return DataNodeConstant.KIND_PDMCLM;
    }

    public String getCnName() {
        return cnName;
    }

    public void setCnName(String cnName) {
        this.cnName = cnName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public Integer getPrec() {
        return prec;
    }

    public void setPrec(Integer prec) {
        this.prec = prec;
    }

    public PkAndNullable getEntry() {
        return entry;
    }

    public void setEntry(PkAndNullable entry) {
        this.entry = entry;
    }

    public Boolean getPk() {
        return this.entry.getPk();
    }

    public Boolean getNullable() {
        return this.entry.getNullable();
    }

    //给前端antd用的key
    public String getKey() {
        return this.getId();
    }
}
