package com.atlassian.bitbucket.mesh.config;

import com.atlassian.bitbucket.mesh.annotation.ManagedByControlPlane;

import javax.annotation.Nonnull;
import java.time.Duration;
import java.util.concurrent.ExecutorService;

/**
 * The application configuration properties
 */
public interface ApplicationConfig {

    /**
     * @return configuration properties related to authentication
     */
    @Nonnull
    AuthenticationConfig getAuthentication();

    /**
     * @return the default execution timeout
     */
    @ManagedByControlPlane
    @Nonnull
    Duration getDefaultExecutionTimeout();

    /**
     * @return the default idle timeout for processes
     */
    @ManagedByControlPlane
    @Nonnull
    Duration getDefaultIdleTimeout();

    /**
     * @return the maximum number of threads allowed in the common {@link ExecutorService}.
     */
    int getExecutorMaxThreads();

    /**
     * @return the maximum time a caller should wait for a thread in the common {@link ExecutorService} to become
     *         available
     */
    @Nonnull
    Duration getExecutorTimeout();

    /**
     * @return configuration properties related to Git
     */
    @Nonnull
    GitConfig getGit();

    /**
     * @return configuration properties related to gRPC
     */
    @Nonnull
    GrpcConfig getGrpc();

    /**
     * @return configuration properties related to Git LFS
     */
    @Nonnull
    LfsConfig getLfs();

    /**
     * @return configuration properties related to logging
     */
    @Nonnull
    LoggingConfig getLogging();

    /**
     * @return configuration properties related to the node
     */
    @Nonnull
    NodeConfig getNode();

    /**
     * @return configuration properties related to pack caching
     */
    @Nonnull
    PackCacheConfig getPackCache();

    /**
     * @return configuration properties related to OS processes
     */
    @Nonnull
    ProcessConfig getProcess();

    /**
     * @return configuration properties related to profiling
     */
    @Nonnull
    ProfilingConfig getProfiling();

    /**
     * @return configuration properties related to replica repair
     */
    @Nonnull
    RepairConfig getRepair();

    /**
     * @return configuration properties related to replication and transactions
     */
    @Nonnull
    ReplicationConfig getReplication();

    /**
     * @return configuration properties related managing the node's directory
     */
    @Nonnull
    StorageConfig getStorageConfig();

    /**
     * @return configuration properties related to the transcode server
     */
    @Nonnull
    TranscodeConfig getTranscode();

    /**
     * Reloads the application configuration
     */
    void reload();
}
