package p.studio.lsp.events;

import p.studio.utilities.events.EventSubscription;
import p.studio.utilities.events.TypedEventBus;

import java.util.Objects;
import java.util.function.Consumer;

public final class StudioEventBus {
    private final TypedEventBus delegate;

    public StudioEventBus() {
        this(new TypedEventBus());
    }

    public StudioEventBus(TypedEventBus delegate) {
        this.delegate = Objects.requireNonNull(delegate, "delegate");
    }

    public <T extends StudioEvent> EventSubscription subscribe(Class<T> eventType, Consumer<? super T> consumer) {
        return delegate.subscribe(eventType, consumer);
    }

    public void publish(StudioEvent event) {
        delegate.publish(event);
    }
}
