syntax = "proto3";

option go_package ="./pb";

package pb;

// ------------------------------------
// Messages
// ------------------------------------

//--------------------------------favorites--------------------------------
message Favorites {
  int64 id = 1;
  int64 userId = 2;
  string targetType = 3;
  int64 targetId = 4;
  int64 createdAt = 5;
}

message AddFavoritesReq {
  int64 userId = 1;
  string targetType = 2;
  int64 targetId = 3;
}

message AddFavoritesResp {
  int64 id = 1;
}

message DelFavoritesReq {
  int64 id = 1;
}

message DelFavoritesResp {
}

message GetFavoritesByIdReq {
  int64 id = 1;
}

message GetFavoritesByIdResp {
  Favorites favorites = 1;
}

message SearchFavoritesReq {
  int64 offset = 1;
  int64 limit = 2;
  optional int64 id = 3;
  optional int64 userId = 4;
  optional string targetType = 5;
  optional int64 targetId = 6;
}

message SearchFavoritesResp {
  repeated Favorites favorites = 1;
}

// ------------------------------------
// Rpc Func
// ------------------------------------

service searchService {
  rpc AddFavorites(AddFavoritesReq) returns (AddFavoritesResp);
  rpc DelFavorites(DelFavoritesReq) returns (DelFavoritesResp);
  rpc GetFavoritesById(GetFavoritesByIdReq) returns (GetFavoritesByIdResp);
  rpc SearchFavorites(SearchFavoritesReq) returns (SearchFavoritesResp);
}
