using System.ComponentModel;
using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
///
/// A news post of the site, as stored in PocketBase.
///
///
/// Post lists are ordered by , newest first.
///
public record Post
{
///
/// Gets the PocketBase record id.
///
[JsonPropertyName("id")]
public string Id { get; init; } = "";
///
/// Gets the publication date as a calendar day.
///
///
/// A post's date is a plain day, not a point in time. It is read as the
/// Berlin calendar day: the UTC value is converted to Europe/Berlin and only
/// the day is kept, so the day an editor picked is the day shown -- no
/// time-of-day, no off-by-one at midnight. See .
///
[JsonPropertyName("date")]
public DateOnly Date { get; init; }
///
/// Gets the heading shown to visitors.
///
///
/// Free text; may contain umlauts and spaces. For the URL, see .
///
[JsonPropertyName("title")]
public string Title { get; init; } = "";
///
/// Gets the post body as Markdown.
///
[JsonPropertyName("body")]
public string Body { get; init; } = "";
///
/// Gets the URL slug of the post, e.g. "herbstbasar" for /posts/herbstbasar.
///
///
/// A lowercase path segment without umlauts.
///
[JsonPropertyName("slug")]
public string Slug { get; init; } = "";
///
/// Gets a value indicating whether the post is visible to visitors of the site.
///
[JsonPropertyName("public")]
public bool Public { get; init; }
}