using System;

namespace ExtensiblePortfolioSite.SDK.Git
{
    /// <summary>
    /// A Git Repository
    /// </summary>
    public interface IRepository : IGitObject
    {
        /// <summary>
        /// Name of the repository
        /// </summary>
        public String Name { get; }
        /// <summary>
        /// Owner of the repository
        /// </summary>
        public IUser Owner { get; }

        /// <summary>
        /// Get a commit from the repository, defaults to latest
        /// </summary>
        /// <param name="HeadOffset">How far to go back in the commit tree (default 0)</param>
        /// <returns>A commit</returns>
        public ICommit? GetCommit(uint HeadOffset = 0);

        /// <summary>
        /// Get a commit from the repository, defaults to latest
        /// </summary>
        /// <param name="HeadOffset">How far to go back in the commit tree (default 0)</param>
        /// <param name="Commit">Reference to the commit</param>
        /// <returns>If the commit could be found</returns>
        public bool TryGetCommit(uint HeadOffset, out ICommit? Commit);

        /// <summary>
        /// Get a commit from the repository by it's hash
        /// </summary>
        /// <param name="Reference">Which commit to get from the repo</param>
        /// <returns>A commit</returns>
        public ICommit? GetCommitByRef(string Reference);

        /// <summary>
        /// Get a commit from the repository, defaults to latest
        /// </summary>
        /// <param name="Reference">Which commit to get from the repo</param>
        /// <param name="Commit">Reference to the commit</param>
        /// <returns>If the commit could be found</returns>
        public bool TryGetCommitByRef(string Reference, out ICommit? Commit);
    }
}
