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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.BlockReportEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
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.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * @Description :
 * @Reference :
 * @Author : wei.peng
 * @CreateDate : 19-12-3 下午5:10
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="BR_POJO_VIEW")
@Api(value="对象视图",description = "对象视图")
public class BrPojoView extends BaseBean {

    private static final long serialVersionUID = 3796940669579576121L;
    @Column(name="POJO_ID")
    @ApiParam(value ="主对象ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pojoId;

    @Column(name="MASTER_ID")
    @ApiParam(value ="主对象ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long masterId;

    @Column(name="VIEW_NAME")
    @ApiParam(value ="视图名称")
    private String viewName;

    @Column(name="FILTER_ID")
    @ApiParam(value ="筛选器ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long filterId;

    @Column(name="POJO_NAME_RDD")
    @ApiParam(value ="对象名称")
    private String pojoNameRdd;

    @Column(name="FILTER_NAME_RDD")
    @ApiParam(value ="筛选器名称")
    private String filterNameRdd;

    @Column(name="VIEW_TYPE")
    @ApiParam(value ="视图类型")
    private Integer viewType;
    public String getViewTypeTxt(){
        return viewType == null ? null : BlockReportEnumUtil.TEMPLATE_TYPE.valueOf(viewType);
    }

    @Column(name="VIEW_DESCRIPTION")
    @ApiParam(value ="视图描述")
    private String viewDescription;

    @Transient
    @ApiParam(value ="显示属性集合")
    private List<BrPojoViewAttr> viewAttrList;

}
