feat(wizard): add WizardPayload with AOT JSON source-gen
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace GmRelay.Shared.Features.Sessions.CreateSession.Wizard;
|
||||||
|
|
||||||
|
public enum WizardCreationType { Single, Pool }
|
||||||
|
|
||||||
|
public enum WizardVisibility { Public, Club, Members }
|
||||||
|
|
||||||
|
public sealed class WizardSlotInput
|
||||||
|
{
|
||||||
|
public DateTimeOffset ScheduledAt { get; set; }
|
||||||
|
public int MaxPlayers { get; set; }
|
||||||
|
public bool Waitlist { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class WizardSingleInput
|
||||||
|
{
|
||||||
|
public DateTimeOffset? ScheduledAt { get; set; }
|
||||||
|
public int? MaxPlayers { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class WizardPayload
|
||||||
|
{
|
||||||
|
public WizardCreationType? Type { get; set; }
|
||||||
|
public string? Title { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public string? ImageFileId { get; set; }
|
||||||
|
public string? ImageUrl { get; set; }
|
||||||
|
public string? System { get; set; }
|
||||||
|
public int? DurationMinutes { get; set; }
|
||||||
|
public WizardVisibility? Visibility { get; set; }
|
||||||
|
public Guid? ClubId { get; set; }
|
||||||
|
public bool? PublishInShowcase { get; set; }
|
||||||
|
public bool? Waitlist { get; set; }
|
||||||
|
public WizardSingleInput? Single { get; set; }
|
||||||
|
public WizardPoolInput? Pool { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class WizardPoolInput
|
||||||
|
{
|
||||||
|
public List<WizardSlotInput> Slots { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSerializable(typeof(WizardPayload))]
|
||||||
|
[JsonSerializable(typeof(WizardSingleInput))]
|
||||||
|
[JsonSerializable(typeof(WizardPoolInput))]
|
||||||
|
[JsonSerializable(typeof(WizardSlotInput))]
|
||||||
|
[JsonSourceGenerationOptions(
|
||||||
|
WriteIndented = false,
|
||||||
|
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
|
||||||
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
public partial class WizardPayloadJsonContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user