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

import cn.estsh.i3plus.pojo.aps.annotation.ExcludeImportExport;
import cn.estsh.i3plus.pojo.aps.common.BaseAPS;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.ERuleGroup;
import com.fasterxml.jackson.annotation.JsonBackReference;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;

/**
 * @Description :规则组合
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_RULE_GROUP")
@Api("规则组合")
@ExcludeImportExport
public class RuleGroup extends BaseAPS {
    private static final long serialVersionUID = 4741897751041891075L;
    @Column(name="CODE")
    @ApiParam(value ="编码")
    private String code;

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

    @ApiParam(value ="当前执行的规则序号")
    private transient Integer curDetailNumber;

    @ApiParam(value ="当前执行的规则名称")
    private transient String curDetailName;

    @JsonBackReference
    public List<RuleDetail> getDetails() { return BeanRelation.list(this, ERuleGroup.Details); }
}
