syntax = "proto3";

package reddit.devvit.common.v1;

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

message ContextActionList {
  repeated ContextActionDescription actions = 1;
}

// Describes a single action provided by an Actor
message ContextActionDescription {
  // Dev-specified ID for this action to determine which one was called in OnAction
  string action_id = 1;
  // User-facing name for this action (i.e.: text in the overflow menu)
  string name = 2;
  // Short, user-facing secondary text to describe what this action is going to do
  string description = 3;
  // Flags to determine in which contexts this action should be displayed
  ContextActionAllowedContexts contexts = 4;
  // Flags to determine what kind of user can see this action
  ContextActionAllowedUsers users = 5;
  // Filters to apply to actions in post context
  optional ContextActionPostFilters post_filters = 6;
}

// Which contexts an action should be applied to
message ContextActionAllowedContexts {
  bool post = 1;
  bool comment = 2;
  bool subreddit = 3;
}

// Restrict access to specific user groups
message ContextActionAllowedUsers {
  // Moderator only
  bool moderator = 1;
  // Member of the subreddit where the Actor is installed
  bool member = 2;
  // Logged out users can perform this action
  bool logged_out = 3;
}

// Filters for post actions
message ContextActionPostFilters {
  // If true, only display action for posts created by the app itself, otherwise for all posts
  optional bool current_app = 1;
}
