package com.r35157.nenjim.hubd;

import crypto.r35157.nenjim.NenjimProcess;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;

/**
 * Coordinates the lifecycle of Nenjim services and applications.
 */
public interface NenjimHub {
    /**
     * Starts all initialized services and applications in dependency order,
     * then blocks while the Hub remains online.
     *
     * @throws Exception if startup or shutdown waiting fails
     */
    void start() throws Exception;

    /**
     * Requests startup of the implementation bound to a fully qualified process
     * interface name in the active context.
     *
     * <p>Dynamic binding through this method is not yet implemented by the
     * reference Hub.</p>
     *
     * @param fqInterfaceName fully qualified interface name; the interface must
     *                        extend {@link NenjimProcess}
     */
    void startProcess(String fqInterfaceName);

    /**
     * Provides a map of all running processes managed by the NenjimHub, keyed by the processId.
     *
     * @return a map of {@code NenjimProcess} running processes
     */
    HashMap<Integer, NenjimProcess> getRunningProcesses();

    /**
     * Performs no operation.
     */
    void noop();
}
