syntax = "proto3";
package dicebot;

service Dicebot {
  rpc GetVariable(GetVariableRequest) returns (GetVariableReply);
  rpc GetAllVariables(GetAllVariablesRequest) returns (GetAllVariablesReply);
  rpc SetVariable(SetVariableRequest) returns (SetVariableReply);
  rpc RoomsForUser(UserIdRequest) returns (RoomsListReply);
}

message GetVariableRequest {
  string user_id = 1;
  string room_id = 2;
  string variable_name = 3;
}

message GetVariableReply {
  string user_id = 1;
  string room_id = 2;
  string variable_name = 3;
  int32 value = 4;
}

message GetAllVariablesRequest {
  string user_id = 1;
  string room_id = 2;
}

message GetAllVariablesReply {
  string user_id = 1;
  string room_id = 2;
  map<string, int32> variables = 3;
}

message SetVariableRequest {
  string user_id = 1;
  string room_id = 2;
  string variable_name = 3;
  int32 value = 4;
}

message SetVariableReply {
  bool success = 1;
}

message UserIdRequest {
  string user_id = 1;
}

message RoomsListReply {
  message Room {
    string room_id = 1;
    string display_name = 2;
  }

  string user_id = 1;
  repeated Room rooms = 2;
}