syntax = "proto3";

message UserSocialInfo {
  int64 ID = 1;
  string created_at = 2;
  string updated_at = 3;
  int64 user_id = 4;
  string provider = 5;
  string access_token = 6;
  string refresh_token = 7;
  string uid = 8;
  string open_id = 9;
  string union_id = 10;
  string key = 11;
  uint64 expires_in = 12;
  string user_profile = 13;

  // relations
  UserInfo user = 14;
}

message UserSocialReq {
  int64 ID = 1;
  int64 user_id = 2;
  string provider = 3;
  string access_token = 4;
  string uid = 5;
  string open_id = 6;
  string union_id = 7;

  bool with_user = 8;

  // 分页查询
  optional Pagination page = 10;
}

message UserSocialListResp {
  optional Pagination page = 1;
  repeated UserSocialInfo data = 2;
}

service Core {
  // User Management
  // group: user_social
  rpc createUserSocial (UserSocialInfo) returns (BaseIDResp);
  // group: user_social
  rpc updateUserSocial (UserSocialInfo) returns (BaseResp);
  // group: user_social
  rpc getUserSocialList (UserSocialReq) returns (UserSocialListResp);
  // group: user_social
  rpc getUserSocial (UserSocialReq) returns (UserSocialInfo);
  // group: user_social
  rpc deleteUserSocial (IDsReq) returns (BaseResp);
}