aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Types/Planner/PlannerResponse.cs
blob: 3d48831bf8942a10b83b8ed82c8ff55e220e2c08 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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; }
    public string? StopId { get; set; }
    public string? StopCode { get; set; }
}