package cn.estsh.i3plus.pojo.form.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.BlockFormEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.List;

/**
 * @Description : 数据对象
 * @Reference :
 * @Author : alwaysfrin
 * @CreateDate : 2019-02-27 10:53
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="bf_data_object")
@Api(value="数据对象",description = "原数据对象，最原始数据")
public class BfDataObject extends BaseBean {

    private static final long serialVersionUID = -6450328805517462673L;
    @Column(name = "DATA_SOURCE_ID")
    @ApiParam(value = "数据源ID", example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long dataSourceId;

    @Column(name="DATA_SOURCE_CODE_RDD")
    @ApiParam(value ="数据源编码")
    private String dataSourceCodeRdd;

    @Column(name="OBJECT_NAME")
    @ApiParam(value ="数据名称")
    private String objectName;

    @Column(name="OBJECT_CLASS_NAME")
    @ApiParam(value ="类名称")
    private String objectClassName;

    @Column(name="OBJECT_TABLE_NAME")
    @ApiParam(value ="数据表名")
    private String objectTableName;

    @Lob
    @Column(name="OBJECT_CONTENT")
    @ApiParam(value ="数据内容")
    private String objectContent;

    @Column(name="OBJECT_STATUS")
    @ApiParam(value ="表状态(是否同步)")
    private Integer objectStatus;

    @AnnoOutputColumn(refClass = BlockFormEnumUtil.FORM_TABLE_TYPE.class)
    @Column(name="OBJECT_TYPE")
    @ApiParam(value ="数据类型")
    private Integer objectType;

    @Column(name="OBJECT_COLUMN_NUM")
    @ApiParam(value ="数据列名数量")
    private Integer objectColumnNum;

    @Column(name="OBJECT_DESCRIPTION")
    @ApiParam(value ="描述")
    private String objectDescription;

    @Transient
    @ApiParam(value = "数据对象属性")
    @AnnoOutputColumn(hidden = true)
    private List<BfDataObjectProperty> propertyList;

    @Transient
    @ApiParam(value = "数据对象主键")
    @AnnoOutputColumn(hidden = true)
    private BfDataObjectProperty primaryKey;

    @Transient
    @ApiParam(value = "数据对象主键属性")
    @AnnoOutputColumn(hidden = true)
    private List<BfDataObjectProperty> primaryPropertyList;

    @Transient
    @ApiParam(value = "数据对象主键属性")
    @AnnoOutputColumn(hidden = true)
    private List<String> primaryNameList;

    @Transient
    @ApiParam(value = "元素对象虚拟属性")
    @AnnoOutputColumn(hidden = true)
    List<BfElementPropertyVirtual> virtualList;

}
