Files
gitcommiteditor/Models/BranchInfo.cs

40 lines
1.3 KiB
C#

using System.Collections.ObjectModel;
namespace MarketAlly.GitCommitEditor.Models;
/// <summary>
/// Represents a branch in a Git repository for display in TreeView.
/// </summary>
public class BranchInfo
{
public string Name { get; init; } = string.Empty;
public string FullName { get; init; } = string.Empty;
public bool IsRemote { get; init; }
public bool IsCurrentHead { get; init; }
public string? LastCommitSha { get; init; }
public DateTimeOffset? LastCommitDate { get; init; }
public string? RemoteName { get; init; }
}
/// <summary>
/// Hierarchical node for TreeView display - can represent a repo or a branch category.
/// </summary>
public class BranchTreeNode
{
public string Name { get; set; } = string.Empty;
public string? Icon { get; set; }
public bool IsExpanded { get; set; } = true;
public BranchInfo? Branch { get; set; }
public ObservableCollection<BranchTreeNode> Children { get; set; } = new();
/// <summary>
/// Display name including icon for current branch indicator
/// </summary>
public string DisplayName => Branch?.IsCurrentHead == true ? $"* {Name}" : Name;
/// <summary>
/// Whether this node represents an actual branch (leaf node)
/// </summary>
public bool IsBranch => Branch != null;
}