syntax = "proto3";

import "types.proto";

package trains.webapi;

message SummarizeServiceRequest {
  uint64 id = 1;
}

message LocationRequest {
  string tiploc = 1;
  string crs = 2;

  bool include_in_past = 3;
}

message ListServicesRequest {
  string rid = 1;
  string uid = 2;
  string headcode = 3;
  string scheduled_start_date = 4;
  string train_operator_code = 5;

  LocationRequest origin = 6;
  LocationRequest destination = 7;
  LocationRequest calling_at = 8;
  LocationRequest passing = 9;

  bool include_deleted = 10;
  
  uint32 max_results = 11;
}

message ServiceList {
  repeated ServiceData services = 1;
}

message ListLocationsRequest {
  bool include_without_crs = 1;
}

message LocationList {
  repeated Location locations = 1;
}

service TrainsService {
  rpc SummarizeService(SummarizeServiceRequest) returns (ServiceData) {}

  rpc ListServices(ListServicesRequest) returns (ServiceList) {}
  rpc ListLocations(ListLocationsRequest) returns (LocationList) {}
}