package cn.estsh.i3plus.pojo.wms.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 : amy
 * @CreateDate : 2018-11-23 13:23
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_ACTION_GROUP_DETAILS")
@Api("作业流程明细")
public class WmsActionGroupDetails extends BaseBean {

    private static final long serialVersionUID = 544189352378073377L;
    @Column(name = "AG_ID")
    @ApiParam(value = "作业流程ID", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long agId;

    @Column(name = "SEQ")
    @ApiParam(value = "序号", example = "0")
    private Integer seq;

    @Column(name = "OK_SEQ")
    @ApiParam(value = "成功跳转步骤", example = "0")
    private Integer okSeq;

    @Column(name = "NG_SEQ")
    @ApiParam(value = "失败跳转步骤", example = "0")
    private Integer ngSeq;

    @Column(name = "VALUE_TYPE")
    @ApiParam(value = "动作类型", example = "10")
    private Integer valueType;

    @Column(name = "TO_UPPER")
    @ApiParam(value = "是否转为大写", example = "2")
    private Integer toUpper;

    @Column(name = "LEN_CHECK")
    @ApiParam(value = "长度检查", example = "0")
    private Integer lenCheck;

    @Column(name = "REGULAR_CHECK")
    @ApiParam(value = "正则校验")
    private String regularCheck;

    @Column(name = "REGULAR_CHECK_FAIL_MSG")
    @ApiParam(value = "正则校验失败提示")
    private String regularCheckFailMsg;

    @Column(name = "AS_ID")
    @ApiParam(value = "作业步骤", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long asId;

    @Column(name = "AT_ID")
    @ApiParam(value = "步骤类型编号", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long atId;

    @Transient
    @ApiParam(value = "作业步骤名称")
    private String asName;

    @Transient
    @ApiParam(value = "步骤类型名称")
    private String atName;

    @Transient
    @ApiParam(value = "流程名称")
    private String agName;

    @Column(name = "GOTO_BTN_CODE")
    @ApiParam(value = "跳转按钮代码")
    private String goToBtnCode;

    @Column(name = "GOTO_BTN_NAME")
    @ApiParam(value = "跳转按钮名称")
    private String goToBtnName;

    @Column(name = "PRE_SHOW")
    @ApiParam(value = "是否预显示", example = "1")
    private Integer preShow;

    @Column(name = "SHOW_AM_ID")
    @ApiParam(value = "回显组件方法ID", example = "1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long showAmId;

    @Column(name = "IS_COMMIT_ABLE")
    @ApiParam(value = "是否可提交", example = "2")
    private Integer isCommitAble;

    @Column(name = "IS_AUTO_OPEN_WINDOW")
    @ApiParam(value = "是否自动开窗", example = "2")
    private Integer isAutoOpenWindow;

    @Column(name = "SEARCH_KEY")
    @ApiParam(value = "搜索KEY")
    private String searchKey;

    @Column(name = "GROUP_KEY")
    @ApiParam(value = "分组KEY")
    private String groupKey;

    public int getSeqVal() {
        return this.seq == null ? 0 : this.seq;
    }

    public int getNgSeqVal() {
        return this.ngSeq == null ? 0 : this.ngSeq;
    }

    public int getOkSeqVal() {
        return this.okSeq == null ? 0 : this.okSeq;
    }

    public long getShowAmIdVal() {
        return this.showAmId == null ? 0 : this.showAmId;
    }

    public int getIsCommitAbleVal() {
        return this.isCommitAble == null ? 0 : this.isCommitAble;
    }

    public int getIsAutoOpenWindowVal() {
        return this.isAutoOpenWindow == null ? 0 : this.isAutoOpenWindow;
    }

    public int getValueTypeVal() {
        return this.valueType == null ? 0 : this.valueType;
    }

    public int getToUpperVal() {
        return this.toUpper == null ? 0 : this.toUpper;
    }

    public int getLenCheckVal() {
        return this.lenCheck == null ? 0 : this.lenCheck;
    }

    public WmsActionGroupDetails() {
    }

    public WmsActionGroupDetails(Long id, Long agId, Integer seq, Integer okSeq, Integer ngSeq, Integer valueType, Integer toUpper,
                                 Integer lenCheck, String regularCheck, String regularCheckFailMsg, Long asId, Long atId,
                                 String asName, String atName, String goToBtnCode, String goToBtnName, Integer preShow,
                                 Long showAmId, Integer isCommitAble, Integer isAutoOpenWindow, String searchKey,
                                 String groupKey, String organizeCode) {
        this.id = id;
        this.agId = agId;
        this.seq = seq;
        this.okSeq = okSeq;
        this.ngSeq = ngSeq;
        this.valueType = valueType;
        this.toUpper = toUpper;
        this.lenCheck = lenCheck;
        this.regularCheck = regularCheck;
        this.regularCheckFailMsg = regularCheckFailMsg;
        this.asId = asId;
        this.atId = atId;
        this.asName = asName;
        this.atName = atName;
        this.goToBtnCode = goToBtnCode;
        this.goToBtnName = goToBtnName;
        this.preShow = preShow;
        this.showAmId = showAmId;
        this.isCommitAble = isCommitAble;
        this.isAutoOpenWindow = isAutoOpenWindow;
        this.searchKey = searchKey;
        this.groupKey = groupKey;
        this.organizeCode = organizeCode;
    }
}
