📄 src/Integrations/Vasttrafik/Dtos.cs
using System;
using System.Text.Json.Serialization;

namespace MMirror.Integrations.Vasttrafik;

[JsonSerializable(typeof(DeparturesResponse))]
internal sealed partial class VasttrafikJsonSerializerContext : JsonSerializerContext;

internal sealed record DeparturesResponse([property: JsonPropertyName("results")] DepartureDto[] Results);

internal sealed record DepartureDto(
    [property: JsonPropertyName("serviceJourney")] ServiceJourney ServiceJourney,
    [property: JsonPropertyName("stopPoint")] StopPoint StopPoint,
    [property: JsonPropertyName("estimatedTime")] DateTimeOffset? EstimatedTime
);

internal sealed record ServiceJourney(
    [property: JsonPropertyName("directionDetails")] DirectionDetails DirectionDetails,
    [property: JsonPropertyName("line")] Line Line
);

internal sealed record DirectionDetails(
    [property: JsonPropertyName("shortDirection")] string Direction,
    [property: JsonPropertyName("via")] string? Via
);

internal sealed record Line(
    [property: JsonPropertyName("shortName")] string Name,
    [property: JsonPropertyName("backgroundColor")] string? BackgroundColor,
    [property: JsonPropertyName("foregroundColor")] string? ForegroundColor,
    [property: JsonPropertyName("transportMode")] string Type
);

internal sealed record StopPoint([property: JsonPropertyName("platform")] string Platform);