aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.Backend/Types
diff options
context:
space:
mode:
Diffstat (limited to 'src/Costasdev.Busurbano.Backend/Types')
-rw-r--r--src/Costasdev.Busurbano.Backend/Types/Otp/OtpModels.cs187
-rw-r--r--src/Costasdev.Busurbano.Backend/Types/Planner/PlannerModels.cs75
2 files changed, 262 insertions, 0 deletions
diff --git a/src/Costasdev.Busurbano.Backend/Types/Otp/OtpModels.cs b/src/Costasdev.Busurbano.Backend/Types/Otp/OtpModels.cs
new file mode 100644
index 0000000..3d3de17
--- /dev/null
+++ b/src/Costasdev.Busurbano.Backend/Types/Otp/OtpModels.cs
@@ -0,0 +1,187 @@
+using System.Text.Json.Serialization;
+
+namespace Costasdev.Busurbano.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; } = new();
+
+ [JsonPropertyName("headsign")]
+ public string? Headsign { 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; }
+}
+
+// Geocoding Models (Pelias-like)
+public class OtpGeocodeResponse
+{
+ [JsonPropertyName("features")]
+ public List<OtpGeocodeFeature> Features { get; set; } = new();
+}
+
+public class OtpGeocodeFeature
+{
+ [JsonPropertyName("geometry")]
+ public OtpGeocodeGeometry? Geometry { get; set; }
+
+ [JsonPropertyName("properties")]
+ public OtpGeocodeProperties? Properties { get; set; }
+}
+
+public class OtpGeocodeGeometry
+{
+ [JsonPropertyName("coordinates")]
+ public List<double> Coordinates { get; set; } = new(); // [lon, lat]
+}
+
+public class OtpGeocodeProperties
+{
+ [JsonPropertyName("name")]
+ public string? Name { get; set; }
+
+ [JsonPropertyName("label")]
+ public string? Label { get; set; }
+
+ [JsonPropertyName("layer")]
+ public string? Layer { get; set; }
+}
diff --git a/src/Costasdev.Busurbano.Backend/Types/Planner/PlannerModels.cs b/src/Costasdev.Busurbano.Backend/Types/Planner/PlannerModels.cs
new file mode 100644
index 0000000..30e5e2d
--- /dev/null
+++ b/src/Costasdev.Busurbano.Backend/Types/Planner/PlannerModels.cs
@@ -0,0 +1,75 @@
+using System.Text.Json.Serialization;
+
+namespace Costasdev.Busurbano.Backend.Types.Planner;
+
+public class RoutePlan
+{
+ public List<Itinerary> Itineraries { get; set; } = new();
+}
+
+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; } = new();
+}
+
+public class Leg
+{
+ public string? Mode { get; set; } // WALK, BUS, etc.
+ 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 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 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 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; }
+}