syntax = "proto3";

package devvit.reddit.v2alpha;

import "devvit/options/options.proto";
import "devvit/reddit/v2alpha/commentv2.proto";
import "devvit/reddit/v2alpha/postv2.proto";
import "devvit/reddit/v2alpha/subredditv2.proto";
import "devvit/reddit/v2alpha/userv2.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/reddit/v2alpha";
option java_package = "com.reddit.devvit.reddit.v2alpha";

enum ModActionType {
  UNKNOWN = 0;
  REMOVE_POST = 1;
  REMOVE_COMMENT = 2;
  APPROVE_POST = 3;
  APPROVE_COMMENT = 4;
  EDIT_POST_FLAIR = 5;
  EDIT_USER_FLAIR = 6;
  LOCK_POST = 7;
  LOCK_COMMENT = 8;
  SPAM_POST = 9;
  SPAM_COMMENT = 10;
  DISTINGUISH_POST = 11;
  DISTINGUISH_COMMENT = 12;
  STICKY_POST = 13;
  STICKY_COMMENT = 14;
}

message ModAction {
  option (devvit.options.trigger) = {
    source: "mod_log"
    action: "insert"
    noun: "item"
  };

  // Replaces the action_type enum. The same string used internally (e.g. "removelink")
  // Marking as optional only for typescript compatibility (public-api).
  optional string action = 8 [(devvit.options.v2_event_path) = "mod_action.action"];

  google.protobuf.Timestamp actioned_at = 2 [(devvit.options.v2_event_path) = "client_timestamp"];
  SubredditV2 subreddit = 3;
  UserV2 moderator = 4;

  UserV2 target_user = 5 [(devvit.options.v2_event_path) = "mod_action.target_user_id"];
  optional CommentV2 target_comment = 6;
  optional PostV2 target_post = 7;
  optional string id = 9 [(devvit.options.v2_event_path) = "mod_action.id"];

  // NEXT: 10
}
