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

import cn.estsh.i3plus.pojo.aps.annotation.ExcludeImportExport;
import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BaseAPS;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.ApsEnumUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
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.lang.reflect.Method;
import java.sql.JDBCType;

/**
 * @Description :字段信息
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-11
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="APS_FIELD_INFO")
@Api("字段信息")
@ExcludeImportExport
public class FieldInfo extends BaseAPS {
    private static final long serialVersionUID = -6195036426929675850L;
    @Column(name="CODE")
    @ApiParam(value ="编码")
    @FieldAnnotation(popSearch = true, mainkey = true)
    private String code;

    @Column(name="NAME")
    @ApiParam(value ="名称")
    @FieldAnnotation(popSearch = true)
    private String name;

    @Column(name="CLASS_NAME")
    @ApiParam(value ="所属类简称")
    private String className;

    @Column(name="TYPE")
    @ApiParam(value ="类型")
    private ApsEnumUtil.FIELD_TYPE type;

    @Column(name="TYPE_NAME")
    @ApiParam(value ="类型名称")
    private String typeName;

    @Column(name="TYPE_FULL_NAME")
    @ApiParam(value ="类型全名称包含路径")
    private String typeFullName;

    @Column(name="CUSTOMIZE")
    @ApiParam(value ="是否为自定义字段")
    @FieldAnnotation(defaultValue = "true")
    private Boolean customize = true;

    @Column(name="MODIFY")
    @ApiParam(value ="是否能修改")
    @FieldAnnotation(defaultValue = "true")
    private Boolean modify = true;

    @Column(name="DISPLAY")
    @ApiParam(value ="是否在界面显示")
    @FieldAnnotation(defaultValue = "true")
    private Boolean display = true;

    @Column(name="PRIC")
    @ApiParam(value ="浮点数显示精度")
    @FieldAnnotation(defaultValue = "2")
    private Integer pric;

    @Column(name="TIPS")
    @ApiParam(value ="字段提示")
    private String tips;

    @Column(name="EXPRESSION")
    @ApiParam(value ="表达式")
    private String expression;

    @Column(name="ORDER_NUMBER")
    @ApiParam(value ="序号")
    private Integer orderNumber;

    @Column(name="MAIN_KEY")
    @ApiParam(value ="主键标识")
    private Boolean mainKey;

    @Column(name="JDBC_TYPE")
    @ApiParam(value ="数据库类型")
    private JDBCType jdbcType;

    @Column(name="DEFAULT_VALUE")
    @ApiParam(value ="字段默认值")
    private String defaultValue;

    @Column(name="POP_SEARCH")
    @ApiParam(value ="弹出选择时是否显示")
    private Boolean popSearch;

    @Column(name="EDIT_TYPE")
    @ApiParam(value ="字段编辑类型")
    private ApsEnumUtil.EDIT_TYPE editType;

    @ApiParam(value ="枚举项内容")
    private transient Enum<?>[] enumItems;

    @Column(name = "NOT_EMPTY")
    @ApiParam(value = "不能为空")
    private Boolean notEmpty;

    @JsonIgnore
    @Transient
    private transient Class<? extends BaseBean> clazz;
    @JsonIgnore
    @Transient
    private transient Class<?> typeClass;
    @JsonIgnore
    @Transient
    private transient Method getMethod;
    @JsonIgnore
    @Transient
    private transient Method setMethod;
}
