syntax = "proto3";
option go_package="github.com/maximotejeda/msvc-proto/golang/tgbuser";

message User {
  int64 id = 1;
  int64 tgb_id = 2;
  string username = 3;
  string first_name = 4;
  string last_name = 5;
  string tg_bot = 6;
  int64 created = 7;
  int64 edited = 8;
  int64 deleted = 9;
}
message Bot {
  int64 id = 1;
  string bot_name = 2;
  int64 created = 3;
}
message Ban {
  int64 tgb_id = 1;
  string bot_name = 2;
  int64 until = 3;
  int64 created = 4;
}
message AccessRq {
  int64 tgb_id = 1;
  string bot_name = 2;
  int64 created = 3;
}
message GetTGBUserRequest {
  int64 tgb_id = 1;
}
message GetTGBUserResponse {
  User user = 1;
}
message CreateTGBUserRequest {
  User user = 1;
}
message CreateTGBUserResponse {
  int64 id = 1;
}
message EditTGBUserRequest {
  User user = 1;
}
message EditTGBUserResponse {
  bool response = 1;
}
message DeleteTGBUserRequest {
  int64 tgb_id = 1 ;
}
message DeleteTGBUserResponse {
  bool response = 1;
}
message AddBotTGBUserRequest{
  int64 tgb_id = 1;
  string bot_name = 2;
}

message AddBotTGBUserResponse {
  bool response = 1;
}
message DeleteBotTGBUserRequest{
  int64 tgb_id = 1;
  string bot_name = 2;
}
message DeleteBotTGBUserResponse {
    bool response = 1;
}
message GetBotsTGBUserRequest {
  int64 tgb_id = 1;
}
message GetBotsTGBUserResponse {
  repeated Bot bots = 1;
}

message GetAllBotsUsersRequest{
  string bot_name = 1;
}
message GetAllBotsUsersResponse{
  repeated User users = 1;
}

message GetAllBotsRequest{}
message GetAllBotsResponse{
  repeated Bot bots = 1;
}

message TGBGenericResponse{
  bool response = 1;
}
message TGBUserRequest{
  int64 tgb_id = 1;
}
message TGBBotNameRequest {
  string bot_name = 1;
}
message TGBUserBotNameRequest {
  int64 tgb_id = 1;
  string bot_name =2;
}
message TGBBanUserRequest{
  int64 tgb_id = 1;
  string bot_name = 2;
  int64 until = 3;
}
message GetAccessResponse{
  repeated AccessRq access = 1;
}
message GetBanResponse {
  repeated Ban bans = 1;
}


service UserManager {
  rpc Create(CreateTGBUserRequest)
    returns (CreateTGBUserResponse){}
  rpc Get(GetTGBUserRequest)
    returns (GetTGBUserResponse){}
  rpc Edit(EditTGBUserRequest)
    returns (EditTGBUserResponse){}
  rpc Delete(DeleteTGBUserRequest)
    returns (DeleteTGBUserResponse){}
  rpc AddBot(AddBotTGBUserRequest)
    returns (AddBotTGBUserResponse){}
  rpc DeleteBot(DeleteBotTGBUserRequest)
    returns (DeleteBotTGBUserResponse){}
  rpc GetBots(GetBotsTGBUserRequest)
    returns (GetBotsTGBUserResponse){}
  rpc GetAllBotsUsers(GetAllBotsUsersRequest)
    returns(GetAllBotsUsersResponse){}
  rpc GetAllBots(GetAllBotsRequest)
    returns(GetAllBotsResponse){}
  rpc CreateBot(TGBBotNameRequest)
    returns (TGBGenericResponse){}
  rpc CreateAccessRequest(TGBUserBotNameRequest)
    returns (TGBGenericResponse){}
  rpc GrantAccess(TGBUserBotNameRequest)
    returns (TGBGenericResponse){}
  rpc BanUser(TGBBanUserRequest)
    returns (TGBGenericResponse){}
  rpc UnBanUser(TGBUserBotNameRequest)
    returns (TGBGenericResponse){}
  rpc GetAllAccessRequest(TGBBotNameRequest)
    returns (GetAccessResponse){}
  rpc GetAllBannedUsers(TGBBotNameRequest)
    returns (GetBanResponse){}
  rpc GetAccessRequest(TGBUserRequest)
    returns (GetAccessResponse){}
  rpc GetBannedBot(TGBUserRequest)
    returns (GetBanResponse){}
}
