48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using Fluxor;
|
|
using Koogle.Application.DTOs;
|
|
|
|
namespace Koogle.Web.Store.PersonState;
|
|
|
|
/// <summary>
|
|
/// Fluxor state for person management.
|
|
/// </summary>
|
|
[FeatureState]
|
|
public record PersonState
|
|
{
|
|
/// <summary>
|
|
/// List of all persons for the current club.
|
|
/// </summary>
|
|
public IReadOnlyList<PersonDto> Persons { get; init; } = [];
|
|
|
|
/// <summary>
|
|
/// Currently selected person for editing.
|
|
/// </summary>
|
|
public PersonDto? SelectedPerson { get; init; }
|
|
|
|
/// <summary>
|
|
/// Indicates whether a person operation is in progress.
|
|
/// </summary>
|
|
public bool IsLoading { get; init; }
|
|
|
|
/// <summary>
|
|
/// Error message if operation failed.
|
|
/// </summary>
|
|
public string? Error { get; init; }
|
|
|
|
/// <summary>
|
|
/// Private constructor for Fluxor initialization.
|
|
/// </summary>
|
|
private PersonState() { }
|
|
|
|
/// <summary>
|
|
/// Creates the initial state.
|
|
/// </summary>
|
|
public static PersonState Initial => new()
|
|
{
|
|
Persons = [],
|
|
SelectedPerson = null,
|
|
IsLoading = false,
|
|
Error = null
|
|
};
|
|
}
|