using InnovEnergy.Lib.Utils; namespace InnovEnergy.FossilTui; // ReSharper disable once PropertyCanBeMadeInitOnly.Global public sealed class Change { public FossilState State { get; } public FossilAction SelectedAction { get; private set; } = FossilAction.Ignore; public String File { get; } public Change(FossilState state, String file) { State = state; File = file; } public Boolean Equals(Change? other) { return File == other?.File; } public override Int32 GetHashCode() { return File.GetHashCode(); } public FossilAction SelectNextAction(Boolean canCommit) { return SelectedAction = State .AvailableActions .Unless(a => a == FossilAction.Commit && !canCommit) .ToList() .GetNext(SelectedAction); } public FossilAction SelectPreviousAction(Boolean canCommit) { return SelectedAction = State .AvailableActions .Unless(a => a == FossilAction.Commit && !canCommit) .ToList() .GetPrevious(SelectedAction); } }// ignore me