syntax = "proto3";

package reddit.devvit.drawer_games.v1;

import "reddit/devvit/common/v1/app.proto";
import "reddit/devvit/common/v1/error_message.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/drawer_games/v1;drawer_games";

message GetFeaturedDevvitGameRequest {}

message FeaturedDevvitGame {
  reddit.devvit.common.v1.App app = 1;
  string background_url = 2;
  string cta_link = 3;
  string description = 4;
  string icon_url = 5;
  string title = 6;
  string subreddit_id = 7;
  optional int64 monthly_players = 8;
  bool is_dark_mode = 9;
}

message GetFeaturedDevvitGameResponse {
  FeaturedDevvitGame featured_game = 1;
}

message PersonalizedDevvitGame {
  reddit.devvit.common.v1.App app = 1;
  /** Call to action link. Developer configurable, but defaults to hot posts */
  string cta_link = 2;
  string subreddit_id = 3;
  /** Subtext label below the subreddit name in the games drawer */
  optional string label = 4;
  /** Whether to show a notifcation badge for the game in the games drawer */
  bool badge = 5;
  /** Type of category for this game */
  string category = 6 [deprecated = true];
  /** Type of categories for this game */
  repeated string categories = 7;
}

message GetPersonalizedDevvitGamesRequest {
  repeated string recently_used_app_slugs = 1;
  repeated string subscribed_app_slugs = 2;
}

message GetPersonalizedDevvitGamesResponse {
  repeated PersonalizedDevvitGame games = 1;
}

// This request will hydrate the given recommended posts and return the games to be displayed.
message GetRecommendedDevvitGamesRequest {
  // Posts IDs that are candidates for display.
  repeated string recommended_posts = 1;

  // Maximum number of posts that can be displayed.
  int32 max_posts = 2;
}

message GetRecommendedDevvitGamesResponse {
  // Games to display. These will be a subset of the input recommended_posts.
  // The subset will be generated by deduplicating posts by game and removing the currently featured game.
  repeated RecommendedDevvitGame games = 1;
}

message RecommendedDevvitGame {
  reddit.devvit.common.v1.App app = 1;
  string post_id = 2;
}

message ClearPersonalizedDevvitGameBadgeRequest {
  string app_slug = 1;
}

message ClearPersonalizedDevvitGameBadgeResponse {
  bool ok = 1;
  // Error message if an error occurred while clearing the personalized devvit game badge
  reddit.devvit.common.v1.ErrorMessage error = 2;
}

enum CurationType {
  POPULAR = 0;
  NEW = 1;
  RECENTLY_PLAYED = 2;
}

message GetEntrypointDevvitGamesRequest {
  CurationType curation_type = 1;
}

message GetEntrypointDevvitGamesResponse {
  repeated PersonalizedDevvitGame games = 1;
}
