# Path: gtfspy/networks.py
# ALL_STOP_TO_STOP_LINK_ATTRIBUTES = [
#     "capacity_estimate", "duration_min", "duration_max",
#     "duration_median", "duration_avg", "n_vehicles", "route_types",
#     "d", "distance_shape",
#     "route_I_counts"
# ]
# DEFAULT_STOP_TO_STOP_LINK_ATTRIBUTES = [
#     "n_vehicles", "duration_avg",
#     "d", "route_I_counts"
# ]
# def walk_transfer_stop_to_stop_network(gtfs, max_link_distance=None):
# def stop_to_stop_network_for_route_type(gtfs,
#                                         route_type,
#                                         link_attributes=None,
#                                         start_time_ut=None,
#                                         end_time_ut=None):
# def stop_to_stop_networks_by_type(gtfs):
# def combined_stop_to_stop_transit_network(gtfs, start_time_ut=None, end_time_ut=None):
# def _add_stops_to_net(net, stops):
# def temporal_network(gtfs,
#                      start_time_ut=None,
#                      end_time_ut=None,
#                      route_type=None):
# def route_to_route_network(gtfs, walking_threshold, start_time, end_time):
# 
# Path: gtfspy/route_types.py
# WALK = -1
# TRAM = 0
# SUBWAY = 1
# RAIL = 2
# BUS = 3
# FERRY = 4
# CABLE_CAR = 5
# GONDOLA = 6
# FUNICULAR = 7
# AIRCRAFT = 99
# ALL_ROUTE_TYPES = {WALK, TRAM, SUBWAY, RAIL, BUS, FERRY, CABLE_CAR, GONDOLA, FUNICULAR}
# TRANSIT_ROUTE_TYPES = ALL_ROUTE_TYPES.difference({WALK})
# ROUTE_TYPE_TO_ZORDER = {
#     WALK: 2,
#     BUS: 3,
#     RAIL: 4,
#     SUBWAY: 5,
#     TRAM: 6,
#     FERRY: 7,
#     CABLE_CAR: 8,
#     GONDOLA: 9,
#     FUNICULAR: 10,
#     AIRCRAFT: 11
# }
# ROUTE_TYPE_TO_DESCRIPTION = {
#     WALK: "Walk, pedestrian travel",
#     SUBWAY: "Subway, Metro. Any underground rail system within a metropolitan area.",
#     RAIL: "Rail. Used for intercity or long - distance travel.",
#     BUS: "Bus. Used for short- and long-distance bus routes.",
#     FERRY: "Ferry. Used for short- and long-distance boat service.",
#     CABLE_CAR: "Cable car. Used for street-level cable cars "
#                            "where the cable runs beneath the car.",
#     GONDOLA: "Gondola, Suspended cable car. "
#                          "Typically used for aerial cable cars where "
#                          "the car is suspended from the cable.",
#     FUNICULAR: "Funicular. Any rail system designed for steep inclines."
# }
# ROUTE_TYPE_TO_SHORT_DESCRIPTION = {
#     WALK: "Walk",
#     TRAM: "Tram",
#     SUBWAY: "Subway",
#     RAIL: "Rail",
#     BUS: "Bus",
#     FERRY: "Ferry",
#     CABLE_CAR: "Cable car",
#     GONDOLA: "Gondola",
#     FUNICULAR: "Funicular",
#     AIRCRAFT: "Aircraft"
# }
# ROUTE_TYPE_TO_LOWERCASE_TAG = {
#     WALK: "walk",
#     TRAM: "tram",
#     SUBWAY: "subway",
#     RAIL: "rail",
#     BUS: "bus",
#     FERRY: "ferry",
#     CABLE_CAR: "cablecar",
#     GONDOLA: "gondola",
#     FUNICULAR: "funicular"
# }
# ROUTE_TYPE_TO_APPROXIMATE_CAPACITY = {
#     WALK: None,
#     TRAM: 200,
#     SUBWAY: 600,
#     RAIL: 600,
#     BUS: 80,
#     FERRY: 200,
#     CABLE_CAR: 40,
#     GONDOLA: 20,
#     FUNICULAR: 20
# }
# ROUTE_TYPE_TO_COLOR = {
#     WALK: "black",
#     TRAM: '#33a02c',
#     SUBWAY: "#ff7f00",
#     RAIL: '#e31a1c',
#     BUS: '#1f78b4',
#     FERRY: "#ffff99",
#     CABLE_CAR: "#6a3d9a",
#     GONDOLA: "#b15928",
#     FUNICULAR: "#fb9a99",
#     AIRCRAFT: "#fb9a99"
# }
# def route_type_to_color_iterable(type):
# def route_type_to_zorder(type):


from example_import import load_or_import_example_gtfs
from gtfspy import networks
from gtfspy import route_types

g = load_or_import_example_gtfs()
day_start_ut = g.get_weekly_extract_start_date(ut=True)

start_ut = day_start_ut + 7 * 3600
end_ut = day_start_ut + 8 * 3600


# get elementary bus events (connections) taking place within a given time interval:
all_events = networks.temporal_network(g,
                                       start_time_ut=start_ut,
                                       end_time_ut=end_ut
                                       )
print("Number of elementary PT events during rush hour in Kuopio: ", len(all_events))

# get  elementary bus events (connections) taking place within a given time interval:

# Path: gtfspy/networks.py
# ALL_STOP_TO_STOP_LINK_ATTRIBUTES = [
#     "capacity_estimate", "duration_min", "duration_max",
#     "duration_median", "duration_avg", "n_vehicles", "route_types",
#     "d", "distance_shape",
#     "route_I_counts"
# ]
# DEFAULT_STOP_TO_STOP_LINK_ATTRIBUTES = [
#     "n_vehicles", "duration_avg",
#     "d", "route_I_counts"
# ]
# def walk_transfer_stop_to_stop_network(gtfs, max_link_distance=None):
# def stop_to_stop_network_for_route_type(gtfs,
#                                         route_type,
#                                         link_attributes=None,
#                                         start_time_ut=None,
#                                         end_time_ut=None):
# def stop_to_stop_networks_by_type(gtfs):
# def combined_stop_to_stop_transit_network(gtfs, start_time_ut=None, end_time_ut=None):
# def _add_stops_to_net(net, stops):
# def temporal_network(gtfs,
#                      start_time_ut=None,
#                      end_time_ut=None,
#                      route_type=None):
# def route_to_route_network(gtfs, walking_threshold, start_time, end_time):
# 
# Path: gtfspy/route_types.py
# WALK = -1
# TRAM = 0
# SUBWAY = 1
# RAIL = 2
# BUS = 3
# FERRY = 4
# CABLE_CAR = 5
# GONDOLA = 6
# FUNICULAR = 7
# AIRCRAFT = 99
# ALL_ROUTE_TYPES = {WALK, TRAM, SUBWAY, RAIL, BUS, FERRY, CABLE_CAR, GONDOLA, FUNICULAR}
# TRANSIT_ROUTE_TYPES = ALL_ROUTE_TYPES.difference({WALK})
# ROUTE_TYPE_TO_ZORDER = {
#     WALK: 2,
#     BUS: 3,
#     RAIL: 4,
#     SUBWAY: 5,
#     TRAM: 6,
#     FERRY: 7,
#     CABLE_CAR: 8,
#     GONDOLA: 9,
#     FUNICULAR: 10,
#     AIRCRAFT: 11
# }
# ROUTE_TYPE_TO_DESCRIPTION = {
#     WALK: "Walk, pedestrian travel",
#     SUBWAY: "Subway, Metro. Any underground rail system within a metropolitan area.",
#     RAIL: "Rail. Used for intercity or long - distance travel.",
#     BUS: "Bus. Used for short- and long-distance bus routes.",
#     FERRY: "Ferry. Used for short- and long-distance boat service.",
#     CABLE_CAR: "Cable car. Used for street-level cable cars "
#                            "where the cable runs beneath the car.",
#     GONDOLA: "Gondola, Suspended cable car. "
#                          "Typically used for aerial cable cars where "
#                          "the car is suspended from the cable.",
#     FUNICULAR: "Funicular. Any rail system designed for steep inclines."
# }
# ROUTE_TYPE_TO_SHORT_DESCRIPTION = {
#     WALK: "Walk",
#     TRAM: "Tram",
#     SUBWAY: "Subway",
#     RAIL: "Rail",
#     BUS: "Bus",
#     FERRY: "Ferry",
#     CABLE_CAR: "Cable car",
#     GONDOLA: "Gondola",
#     FUNICULAR: "Funicular",
#     AIRCRAFT: "Aircraft"
# }
# ROUTE_TYPE_TO_LOWERCASE_TAG = {
#     WALK: "walk",
#     TRAM: "tram",
#     SUBWAY: "subway",
#     RAIL: "rail",
#     BUS: "bus",
#     FERRY: "ferry",
#     CABLE_CAR: "cablecar",
#     GONDOLA: "gondola",
#     FUNICULAR: "funicular"
# }
# ROUTE_TYPE_TO_APPROXIMATE_CAPACITY = {
#     WALK: None,
#     TRAM: 200,
#     SUBWAY: 600,
#     RAIL: 600,
#     BUS: 80,
#     FERRY: 200,
#     CABLE_CAR: 40,
#     GONDOLA: 20,
#     FUNICULAR: 20
# }
# ROUTE_TYPE_TO_COLOR = {
#     WALK: "black",
#     TRAM: '#33a02c',
#     SUBWAY: "#ff7f00",
#     RAIL: '#e31a1c',
#     BUS: '#1f78b4',
#     FERRY: "#ffff99",
#     CABLE_CAR: "#6a3d9a",
#     GONDOLA: "#b15928",
#     FUNICULAR: "#fb9a99",
#     AIRCRAFT: "#fb9a99"
# }
# def route_type_to_color_iterable(type):
# def route_type_to_zorder(type):


# Path: examples/example_export.py
from example_import import load_or_import_example_gtfs
from gtfspy import networks
from gtfspy import route_types


g = load_or_import_example_gtfs()
day_start_ut = g.get_weekly_extract_start_date(ut=True)

start_ut = day_start_ut + 7 * 3600
end_ut = day_start_ut + 8 * 3600


# get elementary bus events (connections) taking place within a given time interval:
all_events = networks.temporal_network(g,
                                       start_time_ut=start_ut,
                                       end_time_ut=end_ut
                                       )
print("Number of elementary PT events during rush hour in Kuopio: ", len(all_events))

# get  elementary bus events (connections) taking place within a given time interval:

tram_events = networks.temporal_network(g,