syntax = "proto3";

package devvit.dev_portal.app.info;

import "devvit/dev_portal/app/categories/categories.proto";
import "devvit/dev_portal/app_version/info/app_version_info.proto";
import "devvit/dev_portal/reddit/redditor.proto";
import "google/protobuf/timestamp.proto";
import "reddit/devvit/ads/v1/ads.proto";

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

// This exists in its own file to prevent circular dependency imports between
// app and app_version.

// Contains the details of an app. For field documentation, refer to the Prisma
// schema.
message AppInfo {
  string id = 1;
  // A unique, immutable, and somewhat more readable name for the app; can only
  // be URL-safe chars
  string slug = 2;
  // Human readable name used to be displayed on UIs
  string name = 3;
  // Human readable description
  string description = 4;
  // The t2_ id of the app account associated with this app
  devvit.dev_portal.reddit.Redditor app_account = 15;

  // App is NSFW (default: false)
  bool is_nsfw = 5;
  // Flag to flip when *admins* want to take an app off the App Store listings
  // (default: false)
  bool is_delisted = 6;
  // Flag to designate an app maintained by Reddit, Inc. (default: false)
  bool is_first_party = 13;
  // Flag to flip when *app owners* want to take their app off App Store
  // listings (default: false)
  bool is_archived = 14;
  // Deprecated: Use capabilities instead.
  bool is_webview_enabled = 17 [deprecated = true];

  google.protobuf.Timestamp created_at = 7;
  devvit.dev_portal.reddit.Redditor owner = 8;
  repeated categories.Categories categories = 9;
  AppStats stats = 10;
  // Human readable terms and conditions
  string terms_and_conditions = 11;
  // Human readable privacy policy
  string privacy_policy = 12;

  devvit.dev_portal.app_version.info.ComputePool default_pool = 16;

  reserved 18; // Deprecated field:capabilities
  reserved "capabilities";

  // Flag to flip when *admins* want to switch the app off if the app is
  // behaving oddly, has a bad bug, or breaking something
  bool is_disabled = 19;

  // Flag to forbid the app installation in small subreddits (the actual upper
  // limit is specified in the code) (default: false)
  bool min_subreddit_size_restriction_enabled = 20;

  // T5 ID of the default subreddit to use for this app's playtest sessions
  string default_playtest_subreddit_id = 21;

  // Whether the app is promoted
  .reddit.devvit.ads.v1.AppPromoStatus promo_status = 22;
}

message MultipleAppInfos {
  repeated AppInfo apps = 1;
}

// Contains stats about an app.
message AppStats {
  // How many times/locations is this app currently installed in?
  int32 install_count = 1;
  // How many versions is this app have in total (within search criteria, e.g.
  // may exclude pre-releases)
  int32 versions_count = 2;
}
