package de.accso.flexinale.common.api.eventbus;

import de.accso.flexinale.common.api.event.Event;

public interface EventBus<E extends Event> {

    // Event type specific subscription
    void   subscribe(Class<E> eventType, EventSubscriber<E> subscriber, EventSubscriptionAtStart eventSubscriptionAtStart);
    void unsubscribe(Class<E> eventType, EventSubscriber<E> subscriber);

    // subscription for _all_ Events (i.e. based on Event.class)
    void   subscribe(EventSubscriber<Event> genericSubscriber, EventSubscriptionAtStart eventSubscriptionAtStart);
    void unsubscribe(EventSubscriber<Event> genericSubscriber);

    void unsubscribeAll();

    void publish(Class<E> eventType, E event);

    EventContextHolder getEventContextHolder();
}
