syntax = "proto3";

package devvit.plugin.buildpack;

import "devvit/payments/v1alpha/product.proto";
import "devvit/runtime/bundle.proto";
import "google/protobuf/wrappers.proto";

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

// Actor program and configuration.
message Bundle {
  // See LinkedBundle.code.
  string code = 1;

  // See LinkedBundle.source_map.
  google.protobuf.StringValue source_map = 7;

  // This is the the detail on the bundle itself **and** its dependendencies.
  //
  // to-do: Can we can rename to "spec" or something like that. This is really
  //   confusing because if you want the Bundle's exported actor name (ie,
  //   `Devvit.init(name, ...)`), you have to ask for it form the dependencies
  //   which doesn't make sense.
  devvit.runtime.DependencySpec dependencies = 2;

  // Optional information about the environment the code was built in. Outdated
  // dependencies may indicate an invalid build.
  devvit.runtime.BuildInfo build_info = 3;

  // Old FileSystem assets.
  reserved 4;

  // This map contains the contents of the assets directory, rooted at the
  // assets directory. The keys are the relative paths of the files, and the
  // values are the devvit asset ids used to look up the asset during upload
  //  e.g. "images/en/banner.jpg": "30d509ee-208d-4b45-86b8-b48ef48cc524",
  map<string, string> asset_ids = 5;

  // This map contains html assets from the webroot directory for use in a webview.
  // It has the same structure as asset_ids but is rooted in the webroot directory
  // and is isolated from regular assets.
  map<string, string> webview_asset_ids = 6;

  // This field contains configuration needed to enable the Payments capability
  PaymentsConfig payments_config = 8;

  // The metafile contains the size breakdown of the compiled bundle for analysis
  optional string metafile = 9;

  // Standalone server implementation, without Blocks rendering or "Devvit Classic".
  // If provided, this code is expected to be an entry point for an HTTP server that can
  // handle requests at process.env.WEBBIT_PORT. Present in server (UNIVERSAL)
  // bundles only.
  devvit.runtime.ServerBundle server = 10;

  // next 11.
}

message PaymentsConfig {
  // This map contains products needed by the bundle which will be registered with
  // the Payments API. The string keys are product skus.
  map<string, devvit.payments.v1alpha.Product> products = 1;
}
