package com.atlassian.bitbucket.internal.branch.model;

import com.atlassian.bitbucket.repository.Branch;

import javax.annotation.Nonnull;

/**
 * A node in a graph of branches representing a change flow between those branches.
 *
 * @since 2.8
 */
public interface BranchModelNode {

    /**
     * Get branch at this node.
     *
     * @return branch
     */
    @Nonnull
    Branch getBranch();

    /**
     * Get downstream nodes in the graph, towards which the changes from this node flow. May be empty, if this node is a
     * leaf node that does not have any downstream branches.
     *
     * @return downstream nodes of this branch model node
     */
    @Nonnull
    Iterable<BranchModelNode> getDownstream();

    /**
     * Check whether this node is a leaf node.
     *
     * @return {@code true}, if this node is a leaf node (which also implies that {@link #getDownstream()} is empty),
     * {@code false} otherwise
     */
    boolean isLeaf();
}
