package com.atlassian.bitbucket.mesh.git.transcode;

import javax.annotation.Nonnull;

/**
 * Exposes the {@link #getAddress() address} and {@link #getPort() port} of a TCP/IP server which can be used to
 * process {@link Transcoder transcoding} callbacks.
 */
public interface TranscodeServer {

    /**
     * Retrieves the address where the server is listening.
     *
     * @return the server's address, like {@code 127.0.0.1}
     * @throws IllegalStateException if the server is not {@link #isRunning() running}
     */
    @Nonnull
    String getAddress();

    /**
     * Retrieves the port where the server is listening.
     *
     * @return the server's port
     * @throws IllegalStateException if the server is not {@link #isRunning() running}
     */
    int getPort();

    /**
     * Retrieves a flag indicating whether or not the transcode server is currently running.
     *
     * @return {@code true} if the server is running; otherwise {@code false} if the server has not been started,
     *         has been stopped <i>or has failed</i>
     */
    boolean isRunning();
}
