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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
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", nullable = false)
    @ApiParam(value = "作业流程ID", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    @AnnoOutputColumn
    private Long agId;

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

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

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

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

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

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

    @Column(name = "REGULAR_CHECK", columnDefinition = "varchar(1000) default ''")
    @ApiParam(value = "正则校验")
    private String regularCheck;

    @Column(name = "REGULAR_CHECK_FAIL_MSG", columnDefinition = "varchar(1000) default ''")
    @ApiParam(value = "正则校验失败提示")
    private String regularCheckFailMsg;

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

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

    @Column(name = "GOTO_BTN_CODE", columnDefinition = "varchar(225) default ''")
    @ApiParam(value = "跳转按钮代码")
    private String goToBtnCode;

    @Column(name = "GOTO_BTN_NAME", columnDefinition = "varchar(225) default ''")
    @ApiParam(value = "跳转按钮名称")
    private String goToBtnName;

    @Column(name = "PRE_SHOW", columnDefinition = "int default 0")
    @ApiParam(value = "是否预显示")
    private Integer preShow;

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

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

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

    @Column(name = "SEARCH_KEY", columnDefinition = "varchar(225) default ''")
    @ApiParam(value = "搜索KEY")
    private String searchKey;

    @Column(name = "GROUP_KEY", columnDefinition = "varchar(225) default ''")
    @ApiParam(value = "分组KEY")
    private String groupKey;

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

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

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

    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;
    }
}
