syntax = "proto3";

package devvit.dev_portal.app.info;

import "devvit/dev_portal/app/categories/categories.proto";
import "devvit/dev_portal/app/info/compute_cluster.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 [deprecated = true];
  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;

  // URL to the app icon, if available. This is not guaranteed to be present,
  // and will be empty if the app does not have an approved icon yet.
  optional string app_icon_url = 23;
  repeated categories.AppCategory categories_v2 = 24;
  // Default compute cluster for new installations of this app.
  // Example: "GATSBY" for standard apps, "ELYSIUM_GCP" for GCP-hosted apps.
  ComputeCluster default_compute_cluster = 25;

  // Whether the app is developed by a trusted developer and should have more permissive auto review thresholds
  bool is_trusted = 26;
}

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;
}
