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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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;

/**
 * @Description :按钮功能关系
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2019-03-21 20:29
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="BF_REF_BUTTON_METHOD")
@Api(value="按钮功能关系",description = "按钮功能关系")
public class BfRefButtonMethod extends BaseBean {

    private static final long serialVersionUID = 1145541515189800147L;
    @Column(name="BUTTON_ID")
    @ApiParam(value ="按钮id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long buttonId;

    @Column(name="BUTTON_NAME_RDD")
    @ApiParam(value ="按钮名称")
    private String buttonNameRdd;

    // 枚举 关联位置类型枚举
    @Column(name="BUTTON_POSITION_TYPE")
    @ApiParam(value ="按钮位置类型")
    private Integer buttonPositionType;

    public int getButtonPositionTypeVal(){
        if(buttonId == null){
            return 0;
        } else {
            return buttonPositionType.intValue();
        }
    }

    @Column(name="BUTTON_POSITION_REF_ID")
    @ApiParam(value ="按钮位置关联id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long buttonPositionRefId;

    @Column(name="BUTTON_POSITION_REF_NAME_RDD")
    @ApiParam(value ="按钮位置关联名称")
    private String buttonPositionRefNameRdd;

    /**
     * 关联按钮
     */
    @Transient
    private BfButton bfbutton;

}
