syntax = "proto3";

package devvit.data.api.admin.v1alpha;

import "devvit/data/api/admin/rfr/research_organization.proto";
import "devvit/data/api/admin/rfr/researcher.proto";
import "devvit/data/api/admin/v1alpha/audit.proto";
import "devvit/data/api/admin/v1alpha/auth.proto";
import "devvit/data/api/admin/v1alpha/organization.proto";
import "devvit/data/api/admin/v1alpha/subscription.proto";
import "devvit/data/api/admin/v1alpha/ui.proto";
import "devvit/data/api/admin/v1alpha/user.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/data/api/admin/v1alpha";

service Admin {
  // Auth
  rpc CreateAccessToken(CreateAccessTokenRequest) returns (CreateAccessTokenResponse);
  rpc GetAccessTokenById(GetAccessTokenByIdRequest) returns (GetAccessTokenByIdResponse);
  rpc GetAccessTokensByOrganizationName(GetAccessTokensByOrganizationNameRequest) returns (GetAccessTokensByOrganizationNameResponse);
  rpc RevokeAccessTokenById(RevokeAccessTokenByIdRequest) returns (RevokeAccessTokenByIdResponse);

  // Subscriptions
  rpc CreateSubscription(CreateSubscriptionRequest) returns (CreateSubscriptionResponse);
  rpc GetSubscriptionById(GetSubscriptionByIdRequest) returns (GetSubscriptionByIdResponse);
  rpc GetSubscriptionsByOrganizationName(GetSubscriptionsByOrganizationNameRequest) returns (GetSubscriptionsByOrganizationNameResponse);
  rpc UpdateSubscription(UpdateSubscriptionRequest) returns (UpdateSubscriptionResponse);
  rpc DeleteSubscription(DeleteSubscriptionRequest) returns (DeleteSubscriptionResponse);

  // Organizations
  rpc CreateOrganization(CreateOrganizationRequest) returns (CreateOrganizationResponse);
  rpc DeleteOrganization(DeleteOrganizationRequest) returns (DeleteOrganizationResponse);
  rpc GetOrganizationById(GetOrganizationByIdRequest) returns (GetOrganizationByIdResponse);
  rpc GetOrganizationByName(GetOrganizationByNameRequest) returns (GetOrganizationByNameResponse);
  rpc GetOrganizations(GetOrganizationsRequest) returns (GetOrganizationsResponse);
  rpc UpdateOrganizationById(UpdateOrganizationByIdRequest) returns (UpdateOrganizationResponse);

  // Audit Logs
  rpc GetAuditLogEventsByOrganizationName(GetAuditLogEventsByOrganizationNameRequest) returns (GetAuditLogEventsByOrganizationNameResponse);
  rpc CreateAuditLogEvent(CreateAuditLogEventRequest) returns (CreateAuditLogEventResponse);

  // UI Helpers
  rpc UIGetHydratedOrganizations(UIGetOrganizationsRequest) returns (UIGetOrganizationsResponse);

  rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
  rpc GetUsersByOrgId(GetUsersByOrgIdRequest) returns (GetUsersByOrgIdResponse);
  rpc GetUserById(GetUserByIdRequest) returns (GetUserByIdResponse);
  rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);

  // Reddit for Researchers Organizations
  rpc CreateResearchOrganization(CreateResearchOrganizationRequest) returns (CreateResearchOrganizationResponse);
  rpc GetResearchOrganizations(GetResearchOrganizationsRequest) returns (GetResearchOrganizationsResponse);
  rpc UpdateResearchOrganization(UpdateResearchOrganizationByIdRequest) returns (UpdateResearchOrganizationResponse);
  rpc GetResearchOrganization(GetResearchOrganizationByIdRequest) returns (GetResearchOrganizationByIdResponse);
  rpc DeleteResearchOrganization(DeleteResearchOrganizationRequest) returns (DeleteResearchOrganizationResponse);

  // Reddit for Researchers Users
  rpc CreateResearcher(CreateResearcherRequest) returns (CreateResearcherResponse);
  rpc GetResearchers(GetResearchersRequest) returns (GetResearchersResponse);
  rpc GetResearcher(GetResearcherByIdRequest) returns (GetResearcherByIdResponse);
  rpc GetResearchersByOrganizationId(GetResearchersByOrganizationIdRequest) returns (GetResearchersByOrganizationIdResponse);
  rpc DeleteResearcher(DeleteResearcherRequest) returns (DeleteResearcherResponse);
}
