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

import cn.axzo.workflow.common.model.request.bpmn.BpmnNoticeConf;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.delegate.event.FlowableEventType;

/**
 * 推送事件对象实现
 *
 * @author wangli
 * @since 2023/11/22 14:02
 */
public class MessagePushEventImpl implements MessagePushEvent {

    private FlowableEventType type;
    private BpmnTaskDelegateAssigner assigner;
    private BpmnNoticeConf noticeConfig;
    private String processInstanceId;
    private String taskId;

    public MessagePushEventImpl(FlowableEventType type) {
        if (type == null) {
            throw new FlowableIllegalArgumentException("type is null");
        }
        this.type = type;
    }

    public MessagePushEventImpl(FlowableEventType type, BpmnTaskDelegateAssigner assigner,
                                BpmnNoticeConf noticeConfig) {
        this.type = type;
        this.assigner = assigner;
        this.noticeConfig = noticeConfig;
    }

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

    public void setType(FlowableEventType type) {
        this.type = type;
    }

    @Override
    public BpmnTaskDelegateAssigner getAssigner() {
        return assigner;
    }

    public void setAssigner(BpmnTaskDelegateAssigner assigner) {
        this.assigner = assigner;
    }

    @Override
    public BpmnNoticeConf getNoticeConfig() {
        return noticeConfig;
    }

    public void setNoticeConfig(BpmnNoticeConf noticeConfig) {
        this.noticeConfig = noticeConfig;
    }

    @Override
    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    @Override
    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    @Override
    public String toString() {
        return getClass() + " - " + type;
    }

}
