syntax = "proto3";

package devvit.dev_portal;

import "devvit/dev_portal/app/app.proto";
import "devvit/dev_portal/curated_game/curated_game.proto";
import "devvit/dev_portal/fetch_domain_request/fetch_domain_request.proto";
import "devvit/dev_portal/installation/installation.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";

option go_package = "github.snooguts.net/reddit/reddit-devplatform-monorepo/go-common/generated/protos/types/devvit/devportal";

service AdminInstallation {
  rpc Upgrade(installation.InstallationUpgradeRequest) returns (installation.FullInstallationInfo);
  rpc UpgradeMany(installation.InstallationUpgradeManyRequest) returns (installation.InstallationUpgradeManyResponse);
}

// Service used for reading and updating fetch domain requests from the Admin Portal.
service AdminFetchDomainRequest {
  // Retrieves a page of fetch domain requests with status PENDING.
  rpc GetPending(fetch_domain_request.GetPendingRequest) returns (fetch_domain_request.GetResponse);
  // Returns the number of fetch domain requests with status PENDING.
  rpc GetPendingRequestsCount(google.protobuf.Empty) returns (google.protobuf.Int32Value);
  // Updates the status of a fetch domain request for a given app.
  rpc UpdateStatusForApp(fetch_domain_request.UpdateStatusForAppRequest) returns (google.protobuf.Empty);
}

// Service used for reading and updating app information from the Admin Portal.
service AdminApp {
  // Retrieves an app by slug with its fetch domain info.
  rpc GetAppBySlugWithDomainInfo(app.GetAppBySlugWithDomainInfoRequest) returns (app.AppWithDomainInfo);
  // Retrieves a page of apps with their fetch domain info.
  rpc GetAppsWithDomainInfo(app.GetAppsWithDomainInfoRequest) returns (app.GetAppsWithDomainInfoResponse);
  // Adds domains to an app's allowedDomains list.
  rpc AddDomainsToApp(app.AddDomainsToAppRequest) returns (google.protobuf.Empty);
  // Removes a domain from an app's allowedDomains list.
  rpc RemoveDomainFromApp(app.RemoveDomainFromAppRequest) returns (google.protobuf.Empty);
}

// Service used for reading and mutating curated games in the Admin Portal.
service AdminCuratedGame {
  // Lists curated game entries, optionally filtered by curation type.
  rpc ListGames(curated_game.ListCuratedGamesRequest) returns (curated_game.ListCuratedGamesResponse);
  // Adds an app to a curated game list.
  rpc AddGame(curated_game.AddCuratedGameRequest) returns (curated_game.AddCuratedGameResponse);
  // Updates rank for an app in the curated games list.
  rpc UpdateGameRank(curated_game.UpdateCuratedGameRankRequest) returns (curated_game.UpdateCuratedGameRankResponse);
  // Removes an app from the curated games list.
  rpc RemoveGame(curated_game.RemoveCuratedGameRequest) returns (google.protobuf.Empty);
}
