Files
C4IT-F4SD-Client/FasdDesktopUi/Basics/Services/Models/TicketOverviewCountsChangedEventArgs.cs
2026-01-28 12:08:39 +01:00

64 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.Services.Models
{
public sealed class TicketOverviewCountsChangedEventArgs : EventArgs
{
public TicketOverviewCountsChangedEventArgs(IReadOnlyList<TileCountChange> changes, IReadOnlyDictionary<string, TileCounts> currentCounts, TileScope? initializedScope = null)
{
Changes = changes ?? Array.Empty<TileCountChange>();
CurrentCounts = currentCounts;
InitializedScope = initializedScope;
}
public IReadOnlyList<TileCountChange> Changes { get; }
public IReadOnlyDictionary<string, TileCounts> CurrentCounts { get; }
public TileScope? InitializedScope { get; }
}
public readonly struct TileCountChange
{
public TileCountChange(string key, TileScope scope, int oldCount, int newCount)
{
Key = key;
Scope = scope;
OldCount = oldCount;
NewCount = newCount;
}
public string Key { get; }
public TileScope Scope { get; }
public int OldCount { get; }
public int NewCount { get; }
public int Delta => NewCount - OldCount;
}
public readonly struct TileCounts
{
public static TileCounts Empty => new TileCounts(0, 0);
public TileCounts(int personal, int role)
{
Personal = personal;
Role = role;
}
public int Personal { get; }
public int Role { get; }
}
public enum TileScope
{
Personal,
Role
}
}