Files
Elternbeirat/Elternbeirat.Contracts/Faq.cs
T

54 lines
1.8 KiB
C#

using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
/// <summary>
/// A single question and answer of the FAQ, as stored in PocketBase.
/// </summary>
/// <remarks>
/// On the FAQ page, entries are grouped by <see cref="Topic"/>.
/// </remarks>
public record Faq
{
/// <summary>
/// Gets the PocketBase record id.
/// </summary>
/// <remarks>
/// <see langword="required"/>: every stored record has an id. Modeling it as
/// required states which fields a record must carry, independent of the store,
/// so a future data source has to supply them too.
/// </remarks>
[JsonPropertyName("id")]
public required string Id { get; init; }
/// <summary>
/// Gets the question as a parent would phrase it.
/// </summary>
/// <remarks>
/// <see langword="required"/>: a FAQ entry without a question is incomplete, and
/// the field is required in PocketBase.
/// </remarks>
[JsonPropertyName("question")]
public required string Question { get; init; }
/// <summary>
/// Gets the answer as Markdown.
/// </summary>
/// <remarks>
/// <see langword="required"/>: a FAQ entry exists to answer its question, so an
/// entry without an answer is incomplete. The field is required in PocketBase.
/// </remarks>
[JsonPropertyName("answer")]
public required string Answer { get; init; }
/// <summary>
/// Gets the topic the question is grouped under, e.g. <c>"mensa"</c>.
/// </summary>
/// <remarks>
/// <see langword="required"/>: the FAQ page groups entries by topic, so an entry
/// without one has no place. The field is required in PocketBase.
/// </remarks>
[JsonPropertyName("topic")]
public required string Topic { get; init; }
}