syntax = "proto3";
option go_package = "git.coopgo.io/coopgo-platform/solidarity-service/servers/grpc/proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "solidarity-api-types.proto";

service SolidarityService {
  rpc SetDriverRegularAvailabilities(DriverRegularAvailabilities) returns (DriverAvailabilitiesResponse) {}
  rpc SetDriverPunctualAvailabilities(DriverPunctualAvailabilities) returns (DriverAvailabilitiesResponse) {}
  rpc CreateBookingSolidarity(CreateBookingSolidarityRequest) returns (CreateBookingSolidarityResponse) {}
  rpc UpdateBookingSolidarity(UpdateBookingSolidarityRequest) returns (UpdateBookingSolidarityResponse) {}
  rpc GetBookingSolidarity(GetBookingSolidarityRequest) returns (GetBookingSolidarityResponse) {}
  rpc GetBookingsByStatus(GetBookingsByStatusRequest) returns (GetBookingsByStatusResponse) {}
  rpc DriverJourneys(DriverJourneysRequest) returns (DriverJourneysResponse) {}
  rpc GetAllPassengers(google.protobuf.Empty) returns (GetAllPassengersResponse) {}
  rpc GetPassenger(GetPassengerRequest) returns (GetPassengerResponse) {}
  rpc SetPassengerTrip(PassengerTripRequest) returns (PassengerTripResponse) {}
}

message PassengerTripRequest{
  User passenger = 1;
  Preferences preferences = 2;
}

message DriverRegularAvailabilities{
  DriverRequest driver_request = 1;
  repeated RegularAvailabilitySlot driver_availabilities = 2;
}

message DriverPunctualAvailabilities{
  DriverRequest driver_request = 1;
  repeated PunctualAvailabilitySlot driver_availabilities = 2;
}

message PassengerTripResponse {
  bool success = 1;
  string message = 2;
}

message DriverAvailabilitiesResponse {
  bool success = 1;
  string message = 2;
}

message CreateBookingSolidarityRequest {
  BookingSolidarityRequest booking = 1;
}

message CreateBookingSolidarityResponse {
  BookingSolidarity booking = 1;
}

message UpdateBookingSolidarityRequest {
  string booking_id = 1;
  BookingSolidarityStatus status = 2;
 string message = 3;
}

message UpdateBookingSolidarityResponse {
  bool success = 1;
  string message = 2;
}

message GetBookingSolidarityRequest {
  string booking_id = 1;
}


message GetBookingSolidarityResponse {
  BookingSolidarity booking = 1;
}

message GetBookingsByStatusRequest{
  BookingSolidarityStatus status = 1;
  UserType type = 2;
  string user_id = 3;
}

message DriverJourneysRequest {
  Feature departure = 1;
  google.protobuf.Timestamp departure_date = 2;
}

message DriverJourneysResponse {
  repeated DriverJourney driver_journeys = 1;
}

message GetAllPassengersResponse {
  repeated User passenger = 1;
}

message GetPassengerRequest {
  User passenger = 1;
}

message GetPassengerResponse {
  User passenger = 1;
}

message GetBookingsByStatusResponse{
  repeated BookingSolidarity booking = 1;
}