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

import cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum;
import lombok.Data;
import org.flowable.common.engine.api.delegate.event.FlowableEventType;

import static cn.axzo.workflow.core.engine.event.ReceiveTaskEventType.UPDATE;

/**
 * 扩展任务记录表创建的事件实现
 *
 * @author wangli
 * @since 27/03/2024 15:02
 */
@Data
public class ExtTaskInstUpdateEvent implements ExtTaskInstEvent {
    private final String processInstanceId;
    private final String activityId;
    private final String taskId;
    private String assignee;
    private final BpmnProcessInstanceResultEnum resultEnum;

    public ExtTaskInstUpdateEvent(String processInstanceId, String activityId, String taskId,
                                  String assignee, BpmnProcessInstanceResultEnum resultEnum) {
        this.processInstanceId = processInstanceId;
        this.activityId = activityId;
        this.taskId = taskId;
        this.assignee = assignee;
        this.resultEnum = resultEnum;
    }

    public ExtTaskInstUpdateEvent(String processInstanceId, String activityId, String taskId,
                                  BpmnProcessInstanceResultEnum resultEnum) {
        this.processInstanceId = processInstanceId;
        this.activityId = activityId;
        this.taskId = taskId;
        this.resultEnum = resultEnum;
    }

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