package cn.axzo.workflow.core.engine.event;

import org.flowable.common.engine.api.delegate.event.FlowableEventType;
import org.flowable.task.service.delegate.DelegateTask;

import java.util.Map;

/**
 * 业务节点通知业务传递审批人的事件
 *
 * @author wangli
 * @since 2023/12/21 11:36
 */
public class BizSpecifyAssigneeEventImpl implements BizSpecifyAssigneeEvent {

    private final BizSpecifyAssigneeEventType type;
    private final String activityId;
    private final String activityName;
    private final String processInstanceId;
    private final String processDefinitionId;
    private final String businessKey;
    private final String executionId;
    private final Map<String, Object> variables;

    public BizSpecifyAssigneeEventImpl(BizSpecifyAssigneeEventType bizSpecifyAssigneeEventType,
                                       DelegateTask delegateTask, String businessKey,
                                       Map<String, Object> processVariables) {
        this.type = bizSpecifyAssigneeEventType;
        this.activityId = delegateTask.getTaskDefinitionKey();
        this.activityName = delegateTask.getName();
        this.processInstanceId = delegateTask.getProcessInstanceId();
        this.processDefinitionId = delegateTask.getProcessDefinitionId();
        this.businessKey = businessKey;
        this.executionId = delegateTask.getExecutionId();
        this.variables = processVariables;
    }

    @Override
    public FlowableEventType getType() {
        return type;
    }

    public String getActivityId() {
        return activityId;
    }

    public String getActivityName() {
        return activityName;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public String getProcessDefinitionId() {
        return processDefinitionId;
    }

    public String getBusinessKey() {
        return businessKey;
    }

    public String getExecutionId() {
        return executionId;
    }

    public Map<String, Object> getVariables() {
        return variables;
    }
}
