using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
///
/// A calendar entry of the Elternbeirat, as stored in PocketBase.
///
///
/// Event lists are ordered by . Unset optional text fields are
/// , never .
///
public record Event
{
///
/// Gets the PocketBase record id.
///
[JsonPropertyName("id")]
public string Id { get; init; } = "";
///
/// Gets the start of the event as Europe/Berlin wall-clock time.
///
///
/// PocketBase stores the value in UTC; it is converted to Berlin local time on
/// deserialization, with daylight saving applied. An all-day event uses 00:00
/// as the time.
///
[JsonPropertyName("start")]
[JsonConverter(typeof(LocalDateTimeConverter))]
public DateTime Start { get; init; }
///
/// Gets the optional end of the event as Europe/Berlin wall-clock time.
///
///
/// The end time, or if the event has no end.
///
[JsonPropertyName("end")]
[JsonConverter(typeof(NullableLocalDateTimeConverter))]
public DateTime? End { get; init; }
///
/// Gets the event name, e.g. "Elternbeiratssitzung".
///
[JsonPropertyName("title")]
public string Title { get; init; } = "";
///
/// Gets the optional location, e.g. "Aula".
///
///
/// The location, or if none is set.
///
[JsonPropertyName("location")]
public string Location { get; init; } = "";
///
/// Gets the optional note, e.g. "Anmeldung erforderlich".
///
///
/// The note, or if none is set.
///
[JsonPropertyName("note")]
public string Note { get; init; } = "";
///
/// Gets a value indicating whether the event is visible to visitors of the site.
///
[JsonPropertyName("public")]
public bool Public { get; init; }
}