package com.atlassian.bitbucket.branch.model;

import com.atlassian.bitbucket.repository.Branch;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Set;

/**
 * Represents a branch model associated with a Stash repository. The branch model describes special semantics that
 * some branches in a repository may have, such as development branch ('HEAD'), production branch (A.K.A. deployment),
 * feature branch, bugfix branch etc.
 * <p>
 * A branch model applied to a repository classifies its branches as one of the 2 significant branches (Development or
 * Production), or into one of the branch types, which can be used to facilitate various workflows in that repository.
 */
public interface BranchModel {

    /**
     * Get the branch classifier associated with this branch model.
     *
     * @return branch classifier used to assign branches to branch types in this branch model
     */
    @Nonnull
    BranchClassifier getClassifier();

    /**
     * Get the development branch associated with the repository. Development branch is a potentially unstable branch
     * where the work on the next version of the software is happening.
     *
     * @return the development branch of the associated repository
     */
    @Nonnull
    Branch getDevelopment();

    /**
     * Get the production branch associated with the repository. Production branch is a stable branch from which
     * production-ready versions of the software are released or deployed to the production environment.
     *
     * @return the production branch of the associated repository
     */
    @Nullable
    Branch getProduction();

    /**
     * Get a set of branch types associated with the repository. Branch types represent distinct sets of branches that
     * are created for some specific purpose, e.g. adding new features, or fixing bugs.
     *
     * @return set of enabled branch types of the associated repository
     */
    @Nonnull
    Set<BranchType> getTypes();
}
