using System.Text.Json.Serialization; namespace Elternbeirat.Contracts; /// /// A topic the FAQ entries are grouped under, as stored in PocketBase. /// /// /// A points at its topic through a relation, so the FAQ page /// groups the questions by topic and shows the groups in . /// Making the topic its own record (rather than a free-text field on each /// question) means the heading, its order and its optional /// are edited in one place and shared by every question in the group. /// public record FaqTopic { /// /// Gets the PocketBase record id. /// /// /// : 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. /// [JsonPropertyName("id")] public required string Id { get; init; } /// /// Gets the heading shown above the group of questions, e.g. /// "Mensa und Mittagessen". /// /// /// Free text; may contain umlauts and spaces. For the URL, see . /// : a topic without a heading has nothing to show, and /// the field is required in PocketBase. /// [JsonPropertyName("title")] public required string Title { get; init; } /// /// Gets the URL slug of the topic, e.g. "mensa". /// /// /// A URL path segment: lowercase letters, digits and single hyphens as /// separators, no umlauts. PocketBase enforces this on save via a field /// pattern (^[a-z0-9]+(-[a-z0-9]+)*$), so every stored slug is already /// canonical and the app can use it verbatim. /// /// /// : the slug is required in PocketBase and is the /// stable identifier of a topic, independent of its display title. /// [JsonPropertyName("slug")] public required string Slug { get; init; } /// /// Gets the optional introduction shown below the topic heading, as Markdown. /// /// /// The intro Markdown, or an empty string when the topic has none. /// [JsonPropertyName("intro")] public string Intro { get; init; } = string.Empty; /// /// Gets the sort order of the topic among the FAQ groups. /// /// /// The sort key; topics with smaller values appear first. /// [JsonPropertyName("order")] public double Order { get; init; } }