package com.atlassian.bitbucket.internal.mirroring.mirror.client;

import com.atlassian.bitbucket.mirroring.mirror.UpstreamServer;
import com.atlassian.bitbucket.mirroring.mirror.UpstreamServerType;
import com.atlassian.bitbucket.mirroring.mirror.client.UpstreamClientFactory;

import javax.annotation.Nonnull;

public interface InternalUpstreamClientFactory extends UpstreamClientFactory {

    @Nonnull
    @Override
    InternalUpstreamClient create(@Nonnull UpstreamServer upstream);

    /**
     * Creates a new client for an {@link UpstreamServerType#BITBUCKET_CLOUD cloud} upstream
     *
     * @param upstream the upstream to create the client for
     * @return a new client to interact with the upstream
     * @throws IllegalArgumentException if the supplied upstream is not of the expected
     *                                  {@link UpstreamServer#getType() type}
     */
    @Nonnull
    CloudUpstreamClient createForCloud(@Nonnull UpstreamServer upstream);

    /**
     * Creates a new client for an {@link UpstreamServerType#BITBUCKET_SERVER server} upstream
     *
     * @param upstream the upstream to create the client for
     * @return a new client to interact with the upstream
     * @throws IllegalArgumentException if the supplied upstream is not of the expected
     *                                  {@link UpstreamServer#getType() type}
     */
    @Nonnull
    ServerUpstreamClient createForServer(@Nonnull UpstreamServer upstream);
}
