using Schaad.OpenData.Traffic.Models; namespace Schaad.OpenData.Server.Traffic; public sealed record StationResponse( int Code, string Name, string Municipality, string Address, string Road, double Lat, double Lon, bool FollowsRoad, IReadOnlyList Directions) { public static StationResponse From(Station station, StationGeometry? geometry) => new( station.Code, station.Name, station.Municipality, station.Address, station.Road, station.Location.Lat, station.Location.Lon, geometry?.FollowsRoad ?? false, station.Directions .Select(direction => new DirectionResponse( direction, geometry?.Directions.FirstOrDefault(d => d.Direction == direction)?.Path.Select(p => new[] { p.Lat, p.Lon }).ToList() ?? [])) .ToList()); }