package ru.kirillius.pf.sdn.core;

import lombok.Builder;
import lombok.Getter;
import ru.kirillius.java.utils.events.ConcurrentEventHandler;
import ru.kirillius.java.utils.events.EventHandler;
import ru.kirillius.pf.sdn.core.Networking.NetworkResourceBundle;

/**
 * Aggregates event handlers used to notify the application about runtime state changes.
 */
public final class ContextEventsHandler {
    /**
     * Event fired when network resource bundles are recalculated.
     */
    @Getter
    private final EventHandler<NetworkResourceBundle> networkManagerUpdateEvent = new ConcurrentEventHandler<>();
    /**
     * Event fired when subscription data has been refreshed.
     */
    @Getter
    private final EventHandler<NetworkResourceBundle> subscriptionsUpdateEvent = new ConcurrentEventHandler<>();

    @Getter
    private final EventHandler<ConfigChangeContext> configChangeEvent = new ConcurrentEventHandler<>();

    @Builder
    public final static class ConfigChangeContext {
        @Getter
        private Config initial;
        @Getter
        private Config current;
    }
}
