Files
Elternbeirat/Elternbeirat.Contracts/Page.cs
T

48 lines
1.7 KiB
C#

using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
/// <summary>
/// A content page. Pages also drive the site navigation: <see cref="Location"/>
/// and <see cref="Order"/> decide where and in which order a page appears in the
/// header or footer menu, and <see cref="Embed"/> lists dynamic blocks (posts,
/// events, faqs) rendered below the page body.
/// </summary>
public record Page
{
/// <summary>PocketBase record id.</summary>
[JsonPropertyName("id")]
public string Id { get; init; } = "";
/// <summary>Heading shown to visitors; may contain umlauts and spaces.</summary>
[JsonPropertyName("title")]
public string Title { get; init; } = "";
/// <summary>Page body in Markdown.</summary>
[JsonPropertyName("body")]
public string Body { get; init; } = "";
/// <summary>Where the page appears in the navigation: "header" or "footer".</summary>
[JsonPropertyName("location")]
public string Location { get; init; } = "";
/// <summary>Sort order within its navigation location; smaller is earlier.</summary>
[JsonPropertyName("order")]
public double Order { get; init; }
/// <summary>URL slug (lowercase, no umlauts), e.g. "board" -> /board.</summary>
[JsonPropertyName("slug")]
public string Slug { get; init; } = "";
/// <summary>
/// Dynamic blocks to render below the body: any of "posts", "events", "faqs".
/// Empty for a plain text page.
/// </summary>
[JsonPropertyName("embed")]
public IReadOnlyList<string> Embed { get; init; } = [];
/// <summary>Whether the page is visible to visitors.</summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
}