syntax = "proto3";

package com.igeolise.traveltime.rabbitmq.requests;

message Coords {
  float lat = 1;
  float lng = 2;
}

message Transportation {
  TransportationType type = 1;

  // override defaults for some of the transportation modes
  oneof transportationDetails {
    PublicTransportDetails publicTransport = 2;
    DrivingAndPublicTransportDetails drivingAndPublicTransport = 3;
  }
}

// semantically valid only for TransportationType.PUBLIC_TRANSPORT
message PublicTransportDetails {
  // limits the possible duration of walking paths
  //
  // walkingTimeToStation limit is of low precedence and will not override the global
  // travel time limit
  //
  // walkingTimeToStation must be 0 > and <= 1800
  // if walkingTimeToStation is not set: use service default 
  // if walkingTimeToStation > 0: limit the path to at most this value
  OptionalPositiveUInt32 walkingTimeToStation = 1;
}

// semantically valid only for TransportationType.DRIVING_AND_PUBLIC_TRANSPORT
message DrivingAndPublicTransportDetails {
  // limits the possible duration of walking paths
  //
  // walkingTimeToStation limit is of low precedence and will not override the global
  // travel time limit
  //
  // walkingTimeToStation must be > 0 and <= 1800
  // if walkingTimeToStation is not set: use service default
  // if walkingTimeToStation > 0: limit the walking path to at most this value
  OptionalPositiveUInt32 walkingTimeToStation = 1;

  // limits the possible duration of driving paths
  //
  // drivingTimeToStation limit is of low precedence and will not override the global
  // travel time limit
  //
  // drivingTimeToStation must be > 0 and <= 1800
  // if drivingTimeToStation is not set: use service default
  // if drivingTimeToStation > 0: limit the path to at most this value
  OptionalPositiveUInt32 drivingTimeToStation = 2;

  // constant penalty to apply to simulate the difficulty of finding a parking
  // spot
  //
  // if parkingTime < 0: use service default (300s)
  // if parkingTime >= 0: apply the parking penalty when searching for possible
  //                      paths
  //
  // NOTE: parkingTime penalty cannot be greater than the global travel time
  // limit
  OptionalNonNegativeUInt32 parkingTime = 3;
}

enum TransportationType {
  // Considers all paths found by the following steps:
  // * up to 30 minutes of walking (always included even if no stops found)
  // * all connections in the 30 minute walking range from public transport
  //   stops to other public transport stops in travel_time_limit, AND 
  // * up to 30 minutes of walking from public transport stops that were visited
  //   by public transport (IOW a path
  //     [origin]--walking->[stop]--walking-->[destination] is not possible but 
  //     [origin]--walking->[stop]--public_transport-->[stop]--walking--> is.
  PUBLIC_TRANSPORT = 0;
  // Considers all paths found traveling by car from origin(s) to
  // destination(s) within the travel_time_limit
  DRIVING = 1;
  // Considers all paths found by the following steps:
  // * up to 30 minutes of driving (always included even no stops found)
  // * all connections in the 30 minute driving range from public transport stops
  //   to other public transport stops in travel_time_limit, AND
  // * up to 30 minutes of walking from public transport stops that were visited
  //   by public transport (IOW a path
  //     [origin]--driving->[stop]--walking-->[destination] is not possible but 
  //     [origin]--driving->[stop]--public_transport-->[stop]--walking--> is.
  // AND/OR 
  // * up to 30 minutes of walking
  //
  DRIVING_AND_PUBLIC_TRANSPORT = 2;
  // Considers all paths found travelling by car from origin(s) to
  // destination(s) including all paths that are traversable by ferries that
  // take cars within the travel_time_limit.
  DRIVING_AND_FERRY = 3;
  // Considers all paths found travelling by foot from origin(s) to
  // destination(s) within the travel_time_limit
  WALKING = 4;
  // Considers all paths found travelling by foot from origin(s) to
  // destination(s) including all paths that are traversable by ferries that
  // take passengers within the travel_time_limit
  WALKING_AND_FERRY = 7;
  // Considers all paths found travelling by bike from origin(s) to
  // destination(s) within the travel_time_limit
  CYCLING = 5;
  // Considers all paths found travelling by bike from origin(s) to
  // destination(s) including all paths that are traversable by ferries that
  // take bikes within the travel_time_limit
  CYCLING_AND_FERRY = 6;
}

enum TimePeriod {
  WEEKDAY_MORNING = 0;
}

enum CellPropertyType {
  MEAN = 0;
  MIN = 1;
  MAX = 2;
}

// represents an optional positive (strictly greater than 0) uint32 parameter
//
// the positive requirement cannot be checked at the protocol level and will
// only be verified by the server
message OptionalPositiveUInt32 {
  uint32 value = 1;
}

// represents an optional non negative (greater or equal than 0) uint32 parameter
//
// the non negative requirement  cannot be checked at the protocol level and will only
// be verified by the server
message OptionalNonNegativeUInt32 {
  uint32 value = 1;
}
