syntax = "proto3";

package devvit.data.triggers.v1alpha;

import "devvit/events/v1alpha/events.proto";
import "devvit/options/options.proto";
import "devvit/reddit/v2alpha/modaction.proto";
import "devvit/reddit/v2alpha/modmail.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.snooguts.net/reddit/devplatform-api/go/grpc/devvit/triggers/v1alpha";

message TriggerEvent {
  string id = 1; // UUID for the event
  google.protobuf.Timestamp timestamp = 2; // Event timestamp

  string subreddit = 3;

  oneof type {
    devvit.events.v1alpha.PostSubmit post_submit = 100 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.PostCreate post_create = 113 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = POST_CREATE
    ];
    devvit.events.v1alpha.PostUpdate post_update = 101 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = POST_EDIT
    ];
    devvit.events.v1alpha.PostReport post_report = 102 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.PostFlairUpdate post_flair_update = 109 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.PostDelete post_delete = 111 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = POST_DELETE
    ];

    devvit.events.v1alpha.CommentSubmit comment_submit = 103 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.CommentCreate comment_create = 114 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = COMMENT_CREATE
    ];
    devvit.events.v1alpha.CommentUpdate comment_update = 104 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = COMMENT_EDIT
    ];
    devvit.events.v1alpha.CommentReport comment_report = 105 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.CommentDelete comment_delete = 112 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = COMMENT_DELETE
    ];

    devvit.events.v1alpha.SubredditSubscribe subreddit_subscribe = 106 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.events.v1alpha.AppInstall app_install = 107 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    devvit.events.v1alpha.AppUpgrade app_upgrade = 108 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.reddit.v2alpha.ModAction mod_action = 110 [
      (devvit.options.deliver_to) = {
        to: [
          GATEWAY,
          FIREHOSE
        ]
      },
      (devvit.options.firehose_event_type) = MOD_ACTION
    ];

    devvit.reddit.v2alpha.ModMail mod_mail = 115 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.events.v1alpha.AccountDelete account_delete = 116 [
      (devvit.options.deliver_to) = {
        to: [FIREHOSE]
      },
      (devvit.options.firehose_event_type) = ACCOUNT_DELETE
    ];

    devvit.events.v1alpha.Vote vote = 117 [
      (devvit.options.deliver_to) = {
        to: [FIREHOSE]
      },
      (devvit.options.firehose_event_type) = VOTE
    ];

    devvit.events.v1alpha.PostApprove post_approve = 118 [
      (devvit.options.deliver_to) = {
        to: [FIREHOSE]
      },
      (devvit.options.firehose_event_type) = POST_APPROVE
    ];

    devvit.events.v1alpha.CommentApprove comment_approve = 119 [
      (devvit.options.deliver_to) = {
        to: [FIREHOSE]
      },
      (devvit.options.firehose_event_type) = COMMENT_APPROVE
    ];

    devvit.events.v1alpha.PostNsfwUpdate nsfw_post_update = 120 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.events.v1alpha.PostSpoilerUpdate spoiler_post_update = 121 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.events.v1alpha.AutomoderatorFilterPost automoderator_filter_post = 122 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];

    devvit.events.v1alpha.AutomoderatorFilterComment automoderator_filter_comment = 123 [(devvit.options.deliver_to) = {
      to: [GATEWAY]
    }];
    // NEXT: 124
  }
}
