aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
commita304c24b32c0327436bbd8c2853e60668e161b42 (patch)
tree08f65c05daca134cf4d2e4f779bd15d98fd66370 /src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs
parent120a3c6bddd0fb8d9fa05df4763596956554c025 (diff)
Rename a lot of stuff, add Santiago real time
Diffstat (limited to 'src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs')
-rw-r--r--src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs b/src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs
new file mode 100644
index 0000000..80ef38a
--- /dev/null
+++ b/src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsRoute.cs
@@ -0,0 +1,70 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Enmarcha.Experimental.ServiceViewer.Data.Gtfs.Enums;
+using Microsoft.EntityFrameworkCore;
+
+namespace Enmarcha.Experimental.ServiceViewer.Data.Gtfs;
+
+[Table("gtfs_routes")]
+[PrimaryKey(nameof(Id), nameof(FeedId))]
+public class GtfsRoute
+{
+ [Column("route_id")]
+ [MaxLength(255)]
+ public required string Id { get; set; }
+
+ public string SafeId => Id.Replace(" ", "_").Replace("-", "_");
+
+ [Column("feed_id")]public int FeedId { get; set; }
+ [ForeignKey(nameof(FeedId))] public required Feed Feed { get; set; }
+
+ [Column("agency_id")]
+ [ForeignKey(nameof(Agency))]
+ [MaxLength(255)]
+ public required string AgencyId { get; set; }
+
+ [ForeignKey(nameof(AgencyId))]
+ public GtfsAgency Agency { get; set; } = null!;
+
+ /// <summary>
+ /// Short name of a route. Often a short, abstract identifier (e.g., "32", "100X", "Green")
+ /// that riders use to identify a route. Both route_short_name and route_long_name may be defined.
+ /// </summary>
+ [Column("route_short_name")]
+ [MaxLength(32)]
+ public string ShortName { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Full name of a route. This name is generally more descriptive than the route_short_name and often
+ /// includes the route's destination or stop. Both route_short_name and route_long_name may be defined.
+ /// </summary>
+ [Column("route_long_name")]
+ [MaxLength(255)]
+ public string LongName { get; set; } = string.Empty;
+
+ [Column("route_desc")]
+ [MaxLength(255)]
+ public string? Description { get; set; } = string.Empty;
+
+ [Column("route_type")]
+ public RouteType Type { get; set; } = RouteType.Bus;
+
+ [Column("route_url")]
+ [MaxLength(255)]
+ public string? Url { get; set; } = string.Empty;
+
+ [Column("route_color")]
+ [MaxLength(7)]
+ public string? Color { get; set; } = string.Empty;
+
+ [Column("route_text_color")]
+ [MaxLength(7)]
+ public string? TextColor { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Orders the routes in a way which is ideal for presentation to customers.
+ /// Routes with smaller route_sort_order values should be displayed first.
+ /// </summary>
+ [Column("route_sort_order")]
+ public int SortOrder { get; set; } = 1;
+}