aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Experimental.ServiceViewer/Data/Gtfs/GtfsStopTime.cs
blob: 2bed623c65091bc65ed9110a2a288c87748d99ed (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
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Enmarcha.Experimental.ServiceViewer.Data.Extensions;
using Microsoft.EntityFrameworkCore;

namespace Enmarcha.Experimental.ServiceViewer.Data.Gtfs;

[Table("gtfs_stop_times")]
[PrimaryKey(nameof(TripId), nameof(StopSequence), nameof(FeedId))]
public class GtfsStopTime
{
    [Column("trip_id")]
    [ForeignKey("TripId")]
    [MaxLength(32)]
    public string TripId { get; set; } = null!;

    [Column("feed_id")]public int FeedId { get; set; }
    [ForeignKey(nameof(FeedId))] public required Feed Feed { get; set; }

    [ForeignKey(nameof(TripId))] public GtfsTrip GtfsTrip { get; set; } = null!;

    [Column("arrival_time")] public string Arrival { get; set; }
    public TimeSpan ArrivalTime => TimeSpan.FromGtfsTime(Arrival);

    [Column("departure_time")] public string Departure { get; set; }
    public TimeSpan DepartureTime => TimeSpan.FromGtfsTime(Departure);

    [Column("stop_id")]
    [ForeignKey(nameof(GtfsStop))]
    [MaxLength(32)]
    public required string StopId { get; set; }

    [ForeignKey(nameof(StopId))] public GtfsStop GtfsStop { get; set; } = null!;

    [Column("stop_sequence")] public int StopSequence { get; set; } = 0;

    // [Column("pickup_type")]
    // public int? PickupType { get; set; }
    //
    // [Column("drop_off_type")]
    // public int? DropOffType { get; set; }

    [Column("shape_dist_traveled")] public double? ShapeDistTraveled { get; set; } = null!;
}