feat(configmanager): add TreeNodeViewModel

This commit is contained in:
Joseph Doherty
2026-01-19 17:51:15 -05:00
parent e9fc764650
commit 8caaa8ee54
2 changed files with 280 additions and 4 deletions
@@ -2,17 +2,35 @@ using System.Collections.ObjectModel;
namespace JdeScoping.ConfigManager.ViewModels;
public enum TreeNodeType
{
Folder,
SettingsSection,
Pipeline
}
public enum ValidationState
{
Valid,
Warning,
Error,
Unknown
}
/// <summary>
/// ViewModel for a tree node in the configuration tree.
/// This is a stub implementation for Task 11 - full implementation in Task 12.
/// </summary>
public class TreeNodeViewModel : ViewModelBase
{
private bool _isModified;
private bool _isExpanded;
private bool _isSelected;
private ValidationState _validationState = ValidationState.Unknown;
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public string StatusIcon { get; set; } = string.Empty;
public string Name { get; }
public string Icon { get; }
public TreeNodeType NodeType { get; }
public string? SectionKey { get; init; }
public ObservableCollection<TreeNodeViewModel> Children { get; } = [];
public bool IsModified
@@ -20,4 +38,41 @@ public class TreeNodeViewModel : ViewModelBase
get => _isModified;
set => SetProperty(ref _isModified, value);
}
public bool IsExpanded
{
get => _isExpanded;
set => SetProperty(ref _isExpanded, value);
}
public bool IsSelected
{
get => _isSelected;
set => SetProperty(ref _isSelected, value);
}
public ValidationState ValidationState
{
get => _validationState;
set
{
if (SetProperty(ref _validationState, value))
OnPropertyChanged(nameof(StatusIcon));
}
}
public string StatusIcon => ValidationState switch
{
ValidationState.Valid => "✓",
ValidationState.Warning => "⚠",
ValidationState.Error => "✗",
_ => ""
};
public TreeNodeViewModel(string name, string icon, TreeNodeType nodeType)
{
Name = name;
Icon = icon;
NodeType = nodeType;
}
}