package com.qmth.distributed.print.business.bean.flow;

import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @Description: 自定义流程网关 dto
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/2/10
 */
public class CustomFlowGatewayDto implements Serializable {

    @ApiModelProperty(value = "审批通过排他网关节点id")
    List<String> beforeExclusiveGatewayId;

    @ApiModelProperty(value = "审批驳回排他网关节点id")
    String afterExclusiveGatewayId;

    @ApiModelProperty(value = "流程节点id集合")
    Map<String, List<CustomFlowSequenceDto>> flowTaskIds;

    public CustomFlowGatewayDto() {

    }

    public CustomFlowGatewayDto(String exclusiveGatewayId, Map<String, List<CustomFlowSequenceDto>> flowTaskIds, boolean beforeExclusiveGateway) {
        if (beforeExclusiveGateway) {
            if (Objects.isNull(this.beforeExclusiveGatewayId)) {
                this.beforeExclusiveGatewayId = new ArrayList<>();
            }
            this.beforeExclusiveGatewayId.add(exclusiveGatewayId);
        } else {
            this.afterExclusiveGatewayId = exclusiveGatewayId;
        }
        this.flowTaskIds = flowTaskIds;
    }

    public List<String> getBeforeExclusiveGatewayId() {
        if (Objects.isNull(beforeExclusiveGatewayId)) {
            return new ArrayList<>();
        } else {
            return beforeExclusiveGatewayId;
        }
    }

    public void setBeforeExclusiveGatewayId(List<String> beforeExclusiveGatewayId) {
        this.beforeExclusiveGatewayId = beforeExclusiveGatewayId;
    }

    public String getAfterExclusiveGatewayId() {
        return afterExclusiveGatewayId;
    }

    public void setAfterExclusiveGatewayId(String afterExclusiveGatewayId) {
        this.afterExclusiveGatewayId = afterExclusiveGatewayId;
    }

    public Map<String, List<CustomFlowSequenceDto>> getFlowTaskIds() {
        return flowTaskIds;
    }

    public void setFlowTaskIds(Map<String, List<CustomFlowSequenceDto>> flowTaskIds) {
        this.flowTaskIds = flowTaskIds;
    }
}
