aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsRoute.cs
blob: 261e1832d8e24338c9094179df5c1c74001581e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Costasdev.ServiceViewer.Data.Gtfs.Enums;

namespace Costasdev.ServiceViewer.Data.Gtfs;

[Table("routes")]
public class GtfsRoute
{
    [Key]
    [Column("route_id")]
    [MaxLength(255)]
    public required string Id { get; set; }

    public string SafeId => Id.Replace(" ", "_").Replace("-", "_");

    [Column("agency_id")]
    [ForeignKey(nameof(GtfsAgency))]
    [MaxLength(255)]
    public required string AgencyId { get; set; }

    [ForeignKey(nameof(AgencyId))]
    public GtfsAgency GtfsAgency { 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;
}