diff options
Diffstat (limited to 'src/Enmarcha.Backend/Types')
| -rw-r--r-- | src/Enmarcha.Backend/Types/Arrivals/Arrival.cs | 106 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/Arrivals/StopArrivalsResponse.cs | 21 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs | 38 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/Nominatim/NominatimModels.cs | 75 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/Otp/OtpModels.cs | 165 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/Planner/PlannerResponse.cs | 86 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/StopSchedule.cs | 1542 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/Transit/RouteDtos.cs | 46 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/VigoSchedules.cs | 78 |
9 files changed, 2157 insertions, 0 deletions
diff --git a/src/Enmarcha.Backend/Types/Arrivals/Arrival.cs b/src/Enmarcha.Backend/Types/Arrivals/Arrival.cs new file mode 100644 index 0000000..e99baa7 --- /dev/null +++ b/src/Enmarcha.Backend/Types/Arrivals/Arrival.cs @@ -0,0 +1,106 @@ +using System.Text.Json.Serialization; +using Enmarcha.Backend.Types; + +namespace Enmarcha.Backend.Types.Arrivals; + +public class Arrival +{ + [JsonPropertyName("tripId")] + public required string TripId { get; set; } + + [JsonPropertyName("route")] + public required RouteInfo Route { get; set; } + + [JsonPropertyName("headsign")] + public required HeadsignInfo Headsign { get; set; } + + [JsonPropertyName("estimate")] + public required ArrivalDetails Estimate { get; set; } + + [JsonPropertyName("delay")] + public DelayBadge? Delay { get; set; } + + [JsonPropertyName("shift")] + public ShiftBadge? Shift { get; set; } + + [JsonPropertyName("shape")] + public object? Shape { get; set; } + + [JsonPropertyName("currentPosition")] + public Position? CurrentPosition { get; set; } + + [JsonPropertyName("stopShapeIndex")] + public int? StopShapeIndex { get; set; } + + [JsonIgnore] + public List<string> NextStops { get; set; } = []; + + [JsonIgnore] + public object? RawOtpTrip { get; set; } +} + +public class RouteInfo +{ + [JsonPropertyName("gtfsId")] + public required string GtfsId { get; set; } + + public string RouteIdInGtfs => GtfsId.Split(':', 2)[1]; + + [JsonPropertyName("shortName")] + public required string ShortName { get; set; } + + [JsonPropertyName("colour")] + public required string Colour { get; set; } + + [JsonPropertyName("textColour")] + public required string TextColour { get; set; } +} + +public class HeadsignInfo +{ + [JsonPropertyName("badge")] + public string? Badge { get; set; } + + [JsonPropertyName("destination")] + public required string Destination { get; set; } + + [JsonPropertyName("marquee")] + public string? Marquee { get; set; } +} + +public class ArrivalDetails +{ + [JsonPropertyName("minutes")] + public required int Minutes { get; set; } + + [JsonPropertyName("precision")] + public ArrivalPrecision Precision { get; set; } = ArrivalPrecision.Scheduled; +} + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum ArrivalPrecision +{ + [JsonStringEnumMemberName("confident")] + Confident = 0, + [JsonStringEnumMemberName("unsure")] + Unsure = 1, + [JsonStringEnumMemberName("scheduled")] + Scheduled = 2, + [JsonStringEnumMemberName("past")] + Past = 3 +} + +public class DelayBadge +{ + [JsonPropertyName("minutes")] + public int Minutes { get; set; } +} + +public class ShiftBadge +{ + [JsonPropertyName("shiftName")] + public required string ShiftName { get; set; } + + [JsonPropertyName("shiftTrip")] + public required string ShiftTrip { get; set; } +} diff --git a/src/Enmarcha.Backend/Types/Arrivals/StopArrivalsResponse.cs b/src/Enmarcha.Backend/Types/Arrivals/StopArrivalsResponse.cs new file mode 100644 index 0000000..4d2f481 --- /dev/null +++ b/src/Enmarcha.Backend/Types/Arrivals/StopArrivalsResponse.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; + +namespace Enmarcha.Backend.Types.Arrivals; + +public class StopArrivalsResponse +{ + [JsonPropertyName("stopCode")] + public required string StopCode { get; set; } + + [JsonPropertyName("stopName")] + public required string StopName { get; set; } + + [JsonPropertyName("stopLocation")] + public Position? StopLocation { get; set; } + + [JsonPropertyName("routes")] + public List<RouteInfo> Routes { get; set; } = []; + + [JsonPropertyName("arrivals")] + public List<Arrival> Arrivals { get; set; } = []; +} diff --git a/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs new file mode 100644 index 0000000..55d6e87 --- /dev/null +++ b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs @@ -0,0 +1,38 @@ +namespace Enmarcha.Backend.Types; + +public class ConsolidatedCirculation +{ + public required string Line { get; set; } + public required string Route { get; set; } + + public ScheduleData? Schedule { get; set; } + public RealTimeData? RealTime { get; set; } + public Position? CurrentPosition { get; set; } + public int? StopShapeIndex { get; set; } + public bool IsPreviousTrip { get; set; } + public string? PreviousTripShapeId { get; set; } + public string[] NextStreets { get; set; } = []; +} + +public class RealTimeData +{ + public required int Minutes { get; set; } + public required int Distance { get; set; } +} + +public class ScheduleData +{ + public bool Running { get; set; } + public required int Minutes { get; set; } + public required string ServiceId { get; set; } + public required string TripId { get; set; } + public string? ShapeId { get; set; } +} + +public class Position +{ + public required double Latitude { get; set; } + public required double Longitude { get; set; } + public int OrientationDegrees { get; set; } + public int ShapeIndex { get; set; } +} diff --git a/src/Enmarcha.Backend/Types/Nominatim/NominatimModels.cs b/src/Enmarcha.Backend/Types/Nominatim/NominatimModels.cs new file mode 100644 index 0000000..442e3bb --- /dev/null +++ b/src/Enmarcha.Backend/Types/Nominatim/NominatimModels.cs @@ -0,0 +1,75 @@ +using System.Text.Json.Serialization; + +namespace Enmarcha.Backend.Types.Nominatim; + +public class NominatimSearchResult +{ + [JsonPropertyName("place_id")] + public long PlaceId { get; set; } + + [JsonPropertyName("licence")] + public string? Licence { get; set; } + + [JsonPropertyName("osm_type")] + public string? OsmType { get; set; } + + [JsonPropertyName("osm_id")] + public long OsmId { get; set; } + + [JsonPropertyName("lat")] + public string? Lat { get; set; } + + [JsonPropertyName("lon")] + public string? Lon { get; set; } + + [JsonPropertyName("display_name")] + public string? DisplayName { get; set; } + + [JsonPropertyName("address")] + public NominatimAddress? Address { get; set; } + + [JsonPropertyName("extratags")] + public Dictionary<string, string>? ExtraTags { get; set; } + + [JsonPropertyName("category")] + public string? Category { get; set; } + + [JsonPropertyName("type")] + public string? Type { get; set; } + + [JsonPropertyName("importance")] + public double Importance { get; set; } +} + +public class NominatimAddress +{ + [JsonPropertyName("house_number")] + public string? HouseNumber { get; set; } + + [JsonPropertyName("road")] + public string? Road { get; set; } + + [JsonPropertyName("suburb")] + public string? Suburb { get; set; } + + [JsonPropertyName("city")] + public string? City { get; set; } + + [JsonPropertyName("municipality")] + public string? Municipality { get; set; } + + [JsonPropertyName("county")] + public string? County { get; set; } + + [JsonPropertyName("state")] + public string? State { get; set; } + + [JsonPropertyName("postcode")] + public string? Postcode { get; set; } + + [JsonPropertyName("country")] + public string? Country { get; set; } + + [JsonPropertyName("country_code")] + public string? CountryCode { get; set; } +} diff --git a/src/Enmarcha.Backend/Types/Otp/OtpModels.cs b/src/Enmarcha.Backend/Types/Otp/OtpModels.cs new file mode 100644 index 0000000..d735a81 --- /dev/null +++ b/src/Enmarcha.Backend/Types/Otp/OtpModels.cs @@ -0,0 +1,165 @@ +using System.Text.Json.Serialization; + +namespace Enmarcha.Backend.Types.Otp; + +public class OtpResponse +{ + [JsonPropertyName("plan")] + public OtpPlan? Plan { get; set; } + + [JsonPropertyName("error")] + public OtpError? Error { get; set; } +} + +public class OtpError +{ + [JsonPropertyName("id")] + public int Id { get; set; } + + [JsonPropertyName("msg")] + public string? Msg { get; set; } + + [JsonPropertyName("message")] + public string? Message { get; set; } +} + +public class OtpPlan +{ + [JsonPropertyName("date")] + public long Date { get; set; } + + [JsonPropertyName("from")] + public OtpPlace? From { get; set; } + + [JsonPropertyName("to")] + public OtpPlace? To { get; set; } + + [JsonPropertyName("itineraries")] + public List<OtpItinerary> Itineraries { get; set; } = new(); +} + +public class OtpItinerary +{ + [JsonPropertyName("duration")] + public long Duration { get; set; } + + [JsonPropertyName("startTime")] + public long StartTime { get; set; } + + [JsonPropertyName("endTime")] + public long EndTime { get; set; } + + [JsonPropertyName("walkTime")] + public long WalkTime { get; set; } + + [JsonPropertyName("transitTime")] + public long TransitTime { get; set; } + + [JsonPropertyName("waitingTime")] + public long WaitingTime { get; set; } + + [JsonPropertyName("walkDistance")] + public double WalkDistance { get; set; } + + [JsonPropertyName("legs")] + public List<OtpLeg> Legs { get; set; } = new(); +} + +public class OtpLeg +{ + [JsonPropertyName("startTime")] + public long StartTime { get; set; } + + [JsonPropertyName("endTime")] + public long EndTime { get; set; } + + [JsonPropertyName("mode")] + public string? Mode { get; set; } + + [JsonPropertyName("route")] + public string? Route { get; set; } + + [JsonPropertyName("routeShortName")] + public string? RouteShortName { get; set; } + + [JsonPropertyName("routeLongName")] + public string? RouteLongName { get; set; } + + [JsonPropertyName("agencyName")] + public string? AgencyName { get; set; } + + [JsonPropertyName("from")] + public OtpPlace? From { get; set; } + + [JsonPropertyName("to")] + public OtpPlace? To { get; set; } + + [JsonPropertyName("legGeometry")] + public OtpGeometry? LegGeometry { get; set; } + + [JsonPropertyName("steps")] + public List<OtpWalkStep> Steps { get; set; } = []; + + [JsonPropertyName("headsign")] + public string? Headsign { get; set; } + + [JsonPropertyName("distance")] + public double Distance { get; set; } + + [JsonPropertyName("routeColor")] + public string? RouteColor { get; set; } + + [JsonPropertyName("routeTextColor")] + public string? RouteTextColor { get; set; } + + [JsonPropertyName("intermediateStops")] + public List<OtpPlace> IntermediateStops { get; set; } = []; +} + +public class OtpPlace +{ + [JsonPropertyName("name")] + public string? Name { get; set; } + + [JsonPropertyName("lat")] + public double Lat { get; set; } + + [JsonPropertyName("lon")] + public double Lon { get; set; } + + [JsonPropertyName("stopId")] + public string? StopId { get; set; } + + [JsonPropertyName("stopCode")] + public string? StopCode { get; set; } +} + +public class OtpGeometry +{ + [JsonPropertyName("points")] + public string? Points { get; set; } + + [JsonPropertyName("length")] + public int Length { get; set; } +} + +public class OtpWalkStep +{ + [JsonPropertyName("distance")] + public double Distance { get; set; } + + [JsonPropertyName("relativeDirection")] + public string? RelativeDirection { get; set; } + + [JsonPropertyName("streetName")] + public string? StreetName { get; set; } + + [JsonPropertyName("absoluteDirection")] + public string? AbsoluteDirection { get; set; } + + [JsonPropertyName("lat")] + public double Lat { get; set; } + + [JsonPropertyName("lon")] + public double Lon { get; set; } +} diff --git a/src/Enmarcha.Backend/Types/Planner/PlannerResponse.cs b/src/Enmarcha.Backend/Types/Planner/PlannerResponse.cs new file mode 100644 index 0000000..7713029 --- /dev/null +++ b/src/Enmarcha.Backend/Types/Planner/PlannerResponse.cs @@ -0,0 +1,86 @@ +namespace Enmarcha.Backend.Types.Planner; + +public class RoutePlan +{ + public List<Itinerary> Itineraries { get; set; } = new(); + public long? TimeOffsetSeconds { get; set; } +} + +public class Itinerary +{ + public double DurationSeconds { get; set; } + public DateTime StartTime { get; set; } + public DateTime EndTime { get; set; } + public double WalkDistanceMeters { get; set; } + public double WalkTimeSeconds { get; set; } + public double TransitTimeSeconds { get; set; } + public double WaitingTimeSeconds { get; set; } + public List<Leg> Legs { get; set; } = []; + public decimal? CashFare { get; set; } + public bool? CashFareIsTotal { get; set; } + public decimal? CardFare { get; set; } + public bool? CardFareIsTotal { get; set; } +} + +public class Leg +{ + public string? Mode { get; set; } // WALK, BUS, etc. + public string? FeedId { get; set; } + public string? RouteId { get; set; } + public string? TripId { get; set; } + public string? RouteName { get; set; } + public string? RouteShortName { get; set; } + public string? RouteLongName { get; set; } + public string? Headsign { get; set; } + public string? AgencyName { get; set; } + public string? RouteColor { get; set; } + public string? RouteTextColor { get; set; } + public PlannerPlace? From { get; set; } + public PlannerPlace? To { get; set; } + public DateTime StartTime { get; set; } + public DateTime EndTime { get; set; } + public double DistanceMeters { get; set; } + + // GeoJSON LineString geometry + public PlannerGeometry? Geometry { get; set; } + + public List<Step> Steps { get; set; } = new(); + + public List<PlannerPlace> IntermediateStops { get; set; } = new(); +} + +public class PlannerPlace +{ + public string? Name { get; set; } + public double Lat { get; set; } + public double Lon { get; set; } + public string? StopId { get; set; } + public string? StopCode { get; set; } + public string? ZoneId { get; set; } +} + +public class PlannerGeometry +{ + public string Type { get; set; } = "LineString"; + public List<List<double>> Coordinates { get; set; } = new(); // [[lon, lat], ...] +} + +public class Step +{ + public double DistanceMeters { get; set; } + public string? RelativeDirection { get; set; } + public string? AbsoluteDirection { get; set; } + public string? StreetName { get; set; } + public double Lat { get; set; } + public double Lon { get; set; } +} + +// For Autocomplete/Reverse +public class PlannerSearchResult +{ + public string? Name { get; set; } + public string? Label { get; set; } + public double Lat { get; set; } + public double Lon { get; set; } + public string? Layer { get; set; } +} diff --git a/src/Enmarcha.Backend/Types/StopSchedule.cs b/src/Enmarcha.Backend/Types/StopSchedule.cs new file mode 100644 index 0000000..2a143ea --- /dev/null +++ b/src/Enmarcha.Backend/Types/StopSchedule.cs @@ -0,0 +1,1542 @@ +// <auto-generated> +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: stop_schedule.proto +// </auto-generated> +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Enmarcha.Backend.Types { + + /// <summary>Holder for reflection information generated from stop_schedule.proto</summary> + public static partial class StopScheduleReflection { + + #region Descriptor + /// <summary>File descriptor for stop_schedule.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StopScheduleReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNzdG9wX3NjaGVkdWxlLnByb3RvEgVwcm90byIhCglFcHNnMjU4MjkSCQoB", + "eBgBIAEoARIJCgF5GAIgASgBIoMECgxTdG9wQXJyaXZhbHMSDwoHc3RvcF9p", + "ZBgBIAEoCRIiCghsb2NhdGlvbhgDIAEoCzIQLnByb3RvLkVwc2cyNTgyORI2", + "CghhcnJpdmFscxgFIAMoCzIkLnByb3RvLlN0b3BBcnJpdmFscy5TY2hlZHVs", + "ZWRBcnJpdmFsGoUDChBTY2hlZHVsZWRBcnJpdmFsEhIKCnNlcnZpY2VfaWQY", + "ASABKAkSDwoHdHJpcF9pZBgCIAEoCRIMCgRsaW5lGAMgASgJEg0KBXJvdXRl", + "GAQgASgJEhAKCHNoYXBlX2lkGAUgASgJEhsKE3NoYXBlX2Rpc3RfdHJhdmVs", + "ZWQYBiABKAESFQoNc3RvcF9zZXF1ZW5jZRgLIAEoDRIUCgxuZXh0X3N0cmVl", + "dHMYDCADKAkSFQoNc3RhcnRpbmdfY29kZRgVIAEoCRIVCg1zdGFydGluZ19u", + "YW1lGBYgASgJEhUKDXN0YXJ0aW5nX3RpbWUYFyABKAkSFAoMY2FsbGluZ190", + "aW1lGCEgASgJEhMKC2NhbGxpbmdfc3NtGCIgASgNEhUKDXRlcm1pbnVzX2Nv", + "ZGUYKSABKAkSFQoNdGVybWludXNfbmFtZRgqIAEoCRIVCg10ZXJtaW51c190", + "aW1lGCsgASgJEh4KFnByZXZpb3VzX3RyaXBfc2hhcGVfaWQYMyABKAkiOwoF", + "U2hhcGUSEAoIc2hhcGVfaWQYASABKAkSIAoGcG9pbnRzGAMgAygLMhAucHJv", + "dG8uRXBzZzI1ODI5QiSqAiFDb3N0YXNkZXYuQnVzdXJiYW5vLkJhY2tlbmQu", + "VHlwZXNiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Enmarcha.Backend.Types.Epsg25829), global::Enmarcha.Backend.Types.Epsg25829.Parser, new[]{ "X", "Y" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Enmarcha.Backend.Types.StopArrivals), global::Enmarcha.Backend.Types.StopArrivals.Parser, new[]{ "StopId", "Location", "Arrivals" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival), global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival.Parser, new[]{ "ServiceId", "TripId", "Line", "Route", "ShapeId", "ShapeDistTraveled", "StopSequence", "NextStreets", "StartingCode", "StartingName", "StartingTime", "CallingTime", "CallingSsm", "TerminusCode", "TerminusName", "TerminusTime", "PreviousTripShapeId" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Enmarcha.Backend.Types.Shape), global::Enmarcha.Backend.Types.Shape.Parser, new[]{ "ShapeId", "Points" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class Epsg25829 : pb::IMessage<Epsg25829> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<Epsg25829> _parser = new pb::MessageParser<Epsg25829>(() => new Epsg25829()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<Epsg25829> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Enmarcha.Backend.Types.StopScheduleReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Epsg25829() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Epsg25829(Epsg25829 other) : this() { + x_ = other.x_; + y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Epsg25829 Clone() { + return new Epsg25829(this); + } + + /// <summary>Field number for the "x" field.</summary> + public const int XFieldNumber = 1; + private double x_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double X { + get { return x_; } + set { + x_ = value; + } + } + + /// <summary>Field number for the "y" field.</summary> + public const int YFieldNumber = 2; + private double y_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Y { + get { return y_; } + set { + y_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Epsg25829); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Epsg25829 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(X, other.X)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Y, other.Y)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (X != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(X); + if (Y != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Y); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (X != 0D) { + output.WriteRawTag(9); + output.WriteDouble(X); + } + if (Y != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (X != 0D) { + output.WriteRawTag(9); + output.WriteDouble(X); + } + if (Y != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (X != 0D) { + size += 1 + 8; + } + if (Y != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Epsg25829 other) { + if (other == null) { + return; + } + if (other.X != 0D) { + X = other.X; + } + if (other.Y != 0D) { + Y = other.Y; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + X = input.ReadDouble(); + break; + } + case 17: { + Y = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + X = input.ReadDouble(); + break; + } + case 17: { + Y = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + public sealed partial class StopArrivals : pb::IMessage<StopArrivals> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<StopArrivals> _parser = new pb::MessageParser<StopArrivals>(() => new StopArrivals()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<StopArrivals> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Enmarcha.Backend.Types.StopScheduleReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public StopArrivals() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public StopArrivals(StopArrivals other) : this() { + stopId_ = other.stopId_; + location_ = other.location_ != null ? other.location_.Clone() : null; + arrivals_ = other.arrivals_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public StopArrivals Clone() { + return new StopArrivals(this); + } + + /// <summary>Field number for the "stop_id" field.</summary> + public const int StopIdFieldNumber = 1; + private string stopId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string StopId { + get { return stopId_; } + set { + stopId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "location" field.</summary> + public const int LocationFieldNumber = 3; + private global::Enmarcha.Backend.Types.Epsg25829 location_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Enmarcha.Backend.Types.Epsg25829 Location { + get { return location_; } + set { + location_ = value; + } + } + + /// <summary>Field number for the "arrivals" field.</summary> + public const int ArrivalsFieldNumber = 5; + private static readonly pb::FieldCodec<global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival> _repeated_arrivals_codec + = pb::FieldCodec.ForMessage(42, global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival.Parser); + private readonly pbc::RepeatedField<global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival> arrivals_ = new pbc::RepeatedField<global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField<global::Enmarcha.Backend.Types.StopArrivals.Types.ScheduledArrival> Arrivals { + get { return arrivals_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as StopArrivals); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(StopArrivals other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (StopId != other.StopId) return false; + if (!object.Equals(Location, other.Location)) return false; + if(!arrivals_.Equals(other.arrivals_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (StopId.Length != 0) hash ^= StopId.GetHashCode(); + if (location_ != null) hash ^= Location.GetHashCode(); + hash ^= arrivals_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (StopId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(StopId); + } + if (location_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Location); + } + arrivals_.WriteTo(output, _repeated_arrivals_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StopId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(StopId); + } + if (location_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Location); + } + arrivals_.WriteTo(ref output, _repeated_arrivals_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (StopId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(StopId); + } + if (location_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Location); + } + size += arrivals_.CalculateSize(_repeated_arrivals_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(StopArrivals other) { + if (other == null) { + return; + } + if (other.StopId.Length != 0) { + StopId = other.StopId; + } + if (other.location_ != null) { + if (location_ == null) { + Location = new global::Enmarcha.Backend.Types.Epsg25829(); + } + Location.MergeFrom(other.Location); + } + arrivals_.Add(other.arrivals_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + StopId = input.ReadString(); + break; + } + case 26: { + if (location_ == null) { + Location = new global::Enmarcha.Backend.Types.Epsg25829(); + } + input.ReadMessage(Location); + break; + } + case 42: { + arrivals_.AddEntriesFrom(input, _repeated_arrivals_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + StopId = input.ReadString(); + break; + } + case 26: { + if (location_ == null) { + Location = new global::Enmarcha.Backend.Types.Epsg25829(); + } + input.ReadMessage(Location); + break; + } + case 42: { + arrivals_.AddEntriesFrom(ref input, _repeated_arrivals_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// <summary>Container for nested types declared in the StopArrivals message type.</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public sealed partial class ScheduledArrival : pb::IMessage<ScheduledArrival> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<ScheduledArrival> _parser = new pb::MessageParser<ScheduledArrival>(() => new ScheduledArrival()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<ScheduledArrival> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Enmarcha.Backend.Types.StopArrivals.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScheduledArrival() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScheduledArrival(ScheduledArrival other) : this() { + serviceId_ = other.serviceId_; + tripId_ = other.tripId_; + line_ = other.line_; + route_ = other.route_; + shapeId_ = other.shapeId_; + shapeDistTraveled_ = other.shapeDistTraveled_; + stopSequence_ = other.stopSequence_; + nextStreets_ = other.nextStreets_.Clone(); + startingCode_ = other.startingCode_; + startingName_ = other.startingName_; + startingTime_ = other.startingTime_; + callingTime_ = other.callingTime_; + callingSsm_ = other.callingSsm_; + terminusCode_ = other.terminusCode_; + terminusName_ = other.terminusName_; + terminusTime_ = other.terminusTime_; + previousTripShapeId_ = other.previousTripShapeId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScheduledArrival Clone() { + return new ScheduledArrival(this); + } + + /// <summary>Field number for the "service_id" field.</summary> + public const int ServiceIdFieldNumber = 1; + private string serviceId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ServiceId { + get { return serviceId_; } + set { + serviceId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "trip_id" field.</summary> + public const int TripIdFieldNumber = 2; + private string tripId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string TripId { + get { return tripId_; } + set { + tripId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "line" field.</summary> + public const int LineFieldNumber = 3; + private string line_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Line { + get { return line_; } + set { + line_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "route" field.</summary> + public const int RouteFieldNumber = 4; + private string route_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Route { + get { return route_; } + set { + route_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "shape_id" field.</summary> + public const int ShapeIdFieldNumber = 5; + private string shapeId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ShapeId { + get { return shapeId_; } + set { + shapeId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "shape_dist_traveled" field.</summary> + public const int ShapeDistTraveledFieldNumber = 6; + private double shapeDistTraveled_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double ShapeDistTraveled { + get { return shapeDistTraveled_; } + set { + shapeDistTraveled_ = value; + } + } + + /// <summary>Field number for the "stop_sequence" field.</summary> + public const int StopSequenceFieldNumber = 11; + private uint stopSequence_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint StopSequence { + get { return stopSequence_; } + set { + stopSequence_ = value; + } + } + + /// <summary>Field number for the "next_streets" field.</summary> + public const int NextStreetsFieldNumber = 12; + private static readonly pb::FieldCodec<string> _repeated_nextStreets_codec + = pb::FieldCodec.ForString(98); + private readonly pbc::RepeatedField<string> nextStreets_ = new pbc::RepeatedField<string>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField<string> NextStreets { + get { return nextStreets_; } + } + + /// <summary>Field number for the "starting_code" field.</summary> + public const int StartingCodeFieldNumber = 21; + private string startingCode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string StartingCode { + get { return startingCode_; } + set { + startingCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "starting_name" field.</summary> + public const int StartingNameFieldNumber = 22; + private string startingName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string StartingName { + get { return startingName_; } + set { + startingName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "starting_time" field.</summary> + public const int StartingTimeFieldNumber = 23; + private string startingTime_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string StartingTime { + get { return startingTime_; } + set { + startingTime_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "calling_time" field.</summary> + public const int CallingTimeFieldNumber = 33; + private string callingTime_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string CallingTime { + get { return callingTime_; } + set { + callingTime_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "calling_ssm" field.</summary> + public const int CallingSsmFieldNumber = 34; + private uint callingSsm_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint CallingSsm { + get { return callingSsm_; } + set { + callingSsm_ = value; + } + } + + /// <summary>Field number for the "terminus_code" field.</summary> + public const int TerminusCodeFieldNumber = 41; + private string terminusCode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string TerminusCode { + get { return terminusCode_; } + set { + terminusCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "terminus_name" field.</summary> + public const int TerminusNameFieldNumber = 42; + private string terminusName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string TerminusName { + get { return terminusName_; } + set { + terminusName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "terminus_time" field.</summary> + public const int TerminusTimeFieldNumber = 43; + private string terminusTime_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string TerminusTime { + get { return terminusTime_; } + set { + terminusTime_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "previous_trip_shape_id" field.</summary> + public const int PreviousTripShapeIdFieldNumber = 51; + private string previousTripShapeId_ = ""; + /// <summary> + /// Shape ID of the previous trip when the bus comes from another trip that ends at the starting point + /// </summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string PreviousTripShapeId { + get { return previousTripShapeId_; } + set { + previousTripShapeId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ScheduledArrival); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ScheduledArrival other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ServiceId != other.ServiceId) return false; + if (TripId != other.TripId) return false; + if (Line != other.Line) return false; + if (Route != other.Route) return false; + if (ShapeId != other.ShapeId) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(ShapeDistTraveled, other.ShapeDistTraveled)) return false; + if (StopSequence != other.StopSequence) return false; + if(!nextStreets_.Equals(other.nextStreets_)) return false; + if (StartingCode != other.StartingCode) return false; + if (StartingName != other.StartingName) return false; + if (StartingTime != other.StartingTime) return false; + if (CallingTime != other.CallingTime) return false; + if (CallingSsm != other.CallingSsm) return false; + if (TerminusCode != other.TerminusCode) return false; + if (TerminusName != other.TerminusName) return false; + if (TerminusTime != other.TerminusTime) return false; + if (PreviousTripShapeId != other.PreviousTripShapeId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ServiceId.Length != 0) hash ^= ServiceId.GetHashCode(); + if (TripId.Length != 0) hash ^= TripId.GetHashCode(); + if (Line.Length != 0) hash ^= Line.GetHashCode(); + if (Route.Length != 0) hash ^= Route.GetHashCode(); + if (ShapeId.Length != 0) hash ^= ShapeId.GetHashCode(); + if (ShapeDistTraveled != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ShapeDistTraveled); + if (StopSequence != 0) hash ^= StopSequence.GetHashCode(); + hash ^= nextStreets_.GetHashCode(); + if (StartingCode.Length != 0) hash ^= StartingCode.GetHashCode(); + if (StartingName.Length != 0) hash ^= StartingName.GetHashCode(); + if (StartingTime.Length != 0) hash ^= StartingTime.GetHashCode(); + if (CallingTime.Length != 0) hash ^= CallingTime.GetHashCode(); + if (CallingSsm != 0) hash ^= CallingSsm.GetHashCode(); + if (TerminusCode.Length != 0) hash ^= TerminusCode.GetHashCode(); + if (TerminusName.Length != 0) hash ^= TerminusName.GetHashCode(); + if (TerminusTime.Length != 0) hash ^= TerminusTime.GetHashCode(); + if (PreviousTripShapeId.Length != 0) hash ^= PreviousTripShapeId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ServiceId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ServiceId); + } + if (TripId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(TripId); + } + if (Line.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Line); + } + if (Route.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Route); + } + if (ShapeId.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ShapeId); + } + if (ShapeDistTraveled != 0D) { + output.WriteRawTag(49); + output.WriteDouble(ShapeDistTraveled); + } + if (StopSequence != 0) { + output.WriteRawTag(88); + output.WriteUInt32(StopSequence); + } + nextStreets_.WriteTo(output, _repeated_nextStreets_codec); + if (StartingCode.Length != 0) { + output.WriteRawTag(170, 1); + output.WriteString(StartingCode); + } + if (StartingName.Length != 0) { + output.WriteRawTag(178, 1); + output.WriteString(StartingName); + } + if (StartingTime.Length != 0) { + output.WriteRawTag(186, 1); + output.WriteString(StartingTime); + } + if (CallingTime.Length != 0) { + output.WriteRawTag(138, 2); + output.WriteString(CallingTime); + } + if (CallingSsm != 0) { + output.WriteRawTag(144, 2); + output.WriteUInt32(CallingSsm); + } + if (TerminusCode.Length != 0) { + output.WriteRawTag(202, 2); + output.WriteString(TerminusCode); + } + if (TerminusName.Length != 0) { + output.WriteRawTag(210, 2); + output.WriteString(TerminusName); + } + if (TerminusTime.Length != 0) { + output.WriteRawTag(218, 2); + output.WriteString(TerminusTime); + } + if (PreviousTripShapeId.Length != 0) { + output.WriteRawTag(154, 3); + output.WriteString(PreviousTripShapeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ServiceId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ServiceId); + } + if (TripId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(TripId); + } + if (Line.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Line); + } + if (Route.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Route); + } + if (ShapeId.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ShapeId); + } + if (ShapeDistTraveled != 0D) { + output.WriteRawTag(49); + output.WriteDouble(ShapeDistTraveled); + } + if (StopSequence != 0) { + output.WriteRawTag(88); + output.WriteUInt32(StopSequence); + } + nextStreets_.WriteTo(ref output, _repeated_nextStreets_codec); + if (StartingCode.Length != 0) { + output.WriteRawTag(170, 1); + output.WriteString(StartingCode); + } + if (StartingName.Length != 0) { + output.WriteRawTag(178, 1); + output.WriteString(StartingName); + } + if (StartingTime.Length != 0) { + output.WriteRawTag(186, 1); + output.WriteString(StartingTime); + } + if (CallingTime.Length != 0) { + output.WriteRawTag(138, 2); + output.WriteString(CallingTime); + } + if (CallingSsm != 0) { + output.WriteRawTag(144, 2); + output.WriteUInt32(CallingSsm); + } + if (TerminusCode.Length != 0) { + output.WriteRawTag(202, 2); + output.WriteString(TerminusCode); + } + if (TerminusName.Length != 0) { + output.WriteRawTag(210, 2); + output.WriteString(TerminusName); + } + if (TerminusTime.Length != 0) { + output.WriteRawTag(218, 2); + output.WriteString(TerminusTime); + } + if (PreviousTripShapeId.Length != 0) { + output.WriteRawTag(154, 3); + output.WriteString(PreviousTripShapeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ServiceId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServiceId); + } + if (TripId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TripId); + } + if (Line.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Line); + } + if (Route.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Route); + } + if (ShapeId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ShapeId); + } + if (ShapeDistTraveled != 0D) { + size += 1 + 8; + } + if (StopSequence != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(StopSequence); + } + size += nextStreets_.CalculateSize(_repeated_nextStreets_codec); + if (StartingCode.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(StartingCode); + } + if (StartingName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(StartingName); + } + if (StartingTime.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(StartingTime); + } + if (CallingTime.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(CallingTime); + } + if (CallingSsm != 0) { + size += 2 + pb::CodedOutputStream.ComputeUInt32Size(CallingSsm); + } + if (TerminusCode.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(TerminusCode); + } + if (TerminusName.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(TerminusName); + } + if (TerminusTime.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(TerminusTime); + } + if (PreviousTripShapeId.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PreviousTripShapeId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ScheduledArrival other) { + if (other == null) { + return; + } + if (other.ServiceId.Length != 0) { + ServiceId = other.ServiceId; + } + if (other.TripId.Length != 0) { + TripId = other.TripId; + } + if (other.Line.Length != 0) { + Line = other.Line; + } + if (other.Route.Length != 0) { + Route = other.Route; + } + if (other.ShapeId.Length != 0) { + ShapeId = other.ShapeId; + } + if (other.ShapeDistTraveled != 0D) { + ShapeDistTraveled = other.ShapeDistTraveled; + } + if (other.StopSequence != 0) { + StopSequence = other.StopSequence; + } + nextStreets_.Add(other.nextStreets_); + if (other.StartingCode.Length != 0) { + StartingCode = other.StartingCode; + } + if (other.StartingName.Length != 0) { + StartingName = other.StartingName; + } + if (other.StartingTime.Length != 0) { + StartingTime = other.StartingTime; + } + if (other.CallingTime.Length != 0) { + CallingTime = other.CallingTime; + } + if (other.CallingSsm != 0) { + CallingSsm = other.CallingSsm; + } + if (other.TerminusCode.Length != 0) { + TerminusCode = other.TerminusCode; + } + if (other.TerminusName.Length != 0) { + TerminusName = other.TerminusName; + } + if (other.TerminusTime.Length != 0) { + TerminusTime = other.TerminusTime; + } + if (other.PreviousTripShapeId.Length != 0) { + PreviousTripShapeId = other.PreviousTripShapeId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ServiceId = input.ReadString(); + break; + } + case 18: { + TripId = input.ReadString(); + break; + } + case 26: { + Line = input.ReadString(); + break; + } + case 34: { + Route = input.ReadString(); + break; + } + case 42: { + ShapeId = input.ReadString(); + break; + } + case 49: { + ShapeDistTraveled = input.ReadDouble(); + break; + } + case 88: { + StopSequence = input.ReadUInt32(); + break; + } + case 98: { + nextStreets_.AddEntriesFrom(input, _repeated_nextStreets_codec); + break; + } + case 170: { + StartingCode = input.ReadString(); + break; + } + case 178: { + StartingName = input.ReadString(); + break; + } + case 186: { + StartingTime = input.ReadString(); + break; + } + case 266: { + CallingTime = input.ReadString(); + break; + } + case 272: { + CallingSsm = input.ReadUInt32(); + break; + } + case 330: { + TerminusCode = input.ReadString(); + break; + } + case 338: { + TerminusName = input.ReadString(); + break; + } + case 346: { + TerminusTime = input.ReadString(); + break; + } + case 410: { + PreviousTripShapeId = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ServiceId = input.ReadString(); + break; + } + case 18: { + TripId = input.ReadString(); + break; + } + case 26: { + Line = input.ReadString(); + break; + } + case 34: { + Route = input.ReadString(); + break; + } + case 42: { + ShapeId = input.ReadString(); + break; + } + case 49: { + ShapeDistTraveled = input.ReadDouble(); + break; + } + case 88: { + StopSequence = input.ReadUInt32(); + break; + } + case 98: { + nextStreets_.AddEntriesFrom(ref input, _repeated_nextStreets_codec); + break; + } + case 170: { + StartingCode = input.ReadString(); + break; + } + case 178: { + StartingName = input.ReadString(); + break; + } + case 186: { + StartingTime = input.ReadString(); + break; + } + case 266: { + CallingTime = input.ReadString(); + break; + } + case 272: { + CallingSsm = input.ReadUInt32(); + break; + } + case 330: { + TerminusCode = input.ReadString(); + break; + } + case 338: { + TerminusName = input.ReadString(); + break; + } + case 346: { + TerminusTime = input.ReadString(); + break; + } + case 410: { + PreviousTripShapeId = input.ReadString(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + public sealed partial class Shape : pb::IMessage<Shape> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<Shape> _parser = new pb::MessageParser<Shape>(() => new Shape()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<Shape> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Enmarcha.Backend.Types.StopScheduleReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Shape() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Shape(Shape other) : this() { + shapeId_ = other.shapeId_; + points_ = other.points_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Shape Clone() { + return new Shape(this); + } + + /// <summary>Field number for the "shape_id" field.</summary> + public const int ShapeIdFieldNumber = 1; + private string shapeId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ShapeId { + get { return shapeId_; } + set { + shapeId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "points" field.</summary> + public const int PointsFieldNumber = 3; + private static readonly pb::FieldCodec<global::Enmarcha.Backend.Types.Epsg25829> _repeated_points_codec + = pb::FieldCodec.ForMessage(26, global::Enmarcha.Backend.Types.Epsg25829.Parser); + private readonly pbc::RepeatedField<global::Enmarcha.Backend.Types.Epsg25829> points_ = new pbc::RepeatedField<global::Enmarcha.Backend.Types.Epsg25829>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField<global::Enmarcha.Backend.Types.Epsg25829> Points { + get { return points_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Shape); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Shape other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ShapeId != other.ShapeId) return false; + if(!points_.Equals(other.points_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ShapeId.Length != 0) hash ^= ShapeId.GetHashCode(); + hash ^= points_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ShapeId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ShapeId); + } + points_.WriteTo(output, _repeated_points_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ShapeId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ShapeId); + } + points_.WriteTo(ref output, _repeated_points_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ShapeId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ShapeId); + } + size += points_.CalculateSize(_repeated_points_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Shape other) { + if (other == null) { + return; + } + if (other.ShapeId.Length != 0) { + ShapeId = other.ShapeId; + } + points_.Add(other.points_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ShapeId = input.ReadString(); + break; + } + case 26: { + points_.AddEntriesFrom(input, _repeated_points_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ShapeId = input.ReadString(); + break; + } + case 26: { + points_.AddEntriesFrom(ref input, _repeated_points_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/Enmarcha.Backend/Types/Transit/RouteDtos.cs b/src/Enmarcha.Backend/Types/Transit/RouteDtos.cs new file mode 100644 index 0000000..3904555 --- /dev/null +++ b/src/Enmarcha.Backend/Types/Transit/RouteDtos.cs @@ -0,0 +1,46 @@ +namespace Enmarcha.Backend.Types.Transit; + +public class RouteDto +{ + public required string Id { get; set; } + public string? ShortName { get; set; } + public string? LongName { get; set; } + public string? Color { get; set; } + public string? TextColor { get; set; } + public int? SortOrder { get; set; } + public string? AgencyName { get; set; } + public int TripCount { get; set; } +} + +public class RouteDetailsDto +{ + public string? ShortName { get; set; } + public string? LongName { get; set; } + public string? Color { get; set; } + public string? TextColor { get; set; } + public string? AgencyName { get; set; } + public List<PatternDto> Patterns { get; set; } = []; +} + +public class PatternDto +{ + public required string Id { get; set; } + public string? Name { get; set; } + public string? Headsign { get; set; } + public int DirectionId { get; set; } + public string? Code { get; set; } + public string? SemanticHash { get; set; } + public int TripCount { get; set; } + public List<List<double>>? Geometry { get; set; } + public List<PatternStopDto> Stops { get; set; } = []; +} + +public class PatternStopDto +{ + public required string Id { get; set; } + public string? Code { get; set; } + public required string Name { get; set; } + public double Lat { get; set; } + public double Lon { get; set; } + public List<int> ScheduledDepartures { get; set; } = []; +} diff --git a/src/Enmarcha.Backend/Types/VigoSchedules.cs b/src/Enmarcha.Backend/Types/VigoSchedules.cs new file mode 100644 index 0000000..ee7930f --- /dev/null +++ b/src/Enmarcha.Backend/Types/VigoSchedules.cs @@ -0,0 +1,78 @@ +using System.Text.Json.Serialization; + +namespace Enmarcha.Backend.Types; + +public class ScheduledStop +{ + [JsonPropertyName("trip_id")] public required string TripId { get; set; } + [JsonPropertyName("service_id")] public required string ServiceId { get; set; } + [JsonPropertyName("line")] public required string Line { get; set; } + [JsonPropertyName("route")] public required string Route { get; set; } + [JsonPropertyName("stop_sequence")] public required int StopSequence { get; set; } + + [JsonPropertyName("shape_dist_traveled")] + public required double ShapeDistTraveled { get; set; } + + [JsonPropertyName("next_streets")] public required string[] NextStreets { get; set; } + + [JsonPropertyName("starting_code")] public required string StartingCode { get; set; } + [JsonPropertyName("starting_name")] public required string StartingName { get; set; } + [JsonPropertyName("starting_time")] public required string StartingTime { get; set; } + public DateTime? StartingDateTime(DateTime? baseDate = null) + { + return ParseGtfsTime(StartingTime, baseDate); + } + + [JsonPropertyName("calling_ssm")] public required int CallingSsm { get; set; } + [JsonPropertyName("calling_time")] public required string CallingTime { get; set; } + public DateTime? CallingDateTime(DateTime? baseDate = null) + { + return ParseGtfsTime(CallingTime, baseDate); + } + + [JsonPropertyName("terminus_code")] public required string TerminusCode { get; set; } + [JsonPropertyName("terminus_name")] public required string TerminusName { get; set; } + [JsonPropertyName("terminus_time")] public required string TerminusTime { get; set; } + + /// <summary> + /// Parse GTFS time format (HH:MM:SS) which can have hours >= 24 for services past midnight + /// </summary> + private static DateTime? ParseGtfsTime(string timeStr, DateTime? baseDate = null) + { + if (string.IsNullOrWhiteSpace(timeStr)) + { + return null; + } + + var parts = timeStr.Split(':'); + if (parts.Length != 3) + { + return null; + } + + if (!int.TryParse(parts[0], out var hours) || + !int.TryParse(parts[1], out var minutes) || + !int.TryParse(parts[2], out var seconds)) + { + return null; + } + + // Handle GTFS times that exceed 24 hours (e.g., 25:30:00 for 1:30 AM next day) + var days = hours / 24; + var normalizedHours = hours % 24; + + try + { + var dt = (baseDate ?? DateTime.Today) + .AddDays(days) + .AddHours(normalizedHours) + .AddMinutes(minutes) + .AddSeconds(seconds); + return dt.AddSeconds(60 - dt.Second); + } + catch + { + return null; + } + } +} |
