package com.atlassian.bitbucket.mesh.git.builder.clone;

import com.atlassian.bitbucket.mesh.git.builder.GitProcessBuilder;
import com.atlassian.bitbucket.mesh.layout.StorageLayout;

import javax.annotation.Nonnull;

public class DefaultGitClone implements GitClone {

    private final GitProcessBuilder builder;
    private final StorageLayout storageLayout;

    public DefaultGitClone(GitProcessBuilder builder, StorageLayout storageLayout) {
        this.builder = builder.command("clone");
        this.storageLayout = storageLayout;
    }

    @Nonnull
    @Override
    public GitCloneBuilder bare() {
        return new DefaultGitCloneBuilder(builder, storageLayout, CloneFormat.BARE);
    }

    @Nonnull
    @Override
    public GitCloneBuilder mirror() {
        return new DefaultGitCloneBuilder(builder, storageLayout, CloneFormat.MIRROR);
    }

    @Nonnull
    @Override
    public GitCloneBuilder normal() {
        return new DefaultGitCloneBuilder(builder, storageLayout, CloneFormat.NORMAL);
    }
}
