syntax = "proto3";

package nominal.events.v1;

import "nominal/protos/direct_channel_writer/v2/direct_nominal_channel_writer.proto";
import "nominal/protos/gen/v1/alias.proto";
import "nominal/protos/types/time/time.proto";

option java_multiple_files = true;
option java_package = "io.nominal.events.v1";

// Canonical event type.
message Event {
  oneof event_type {
    DataStreamEvent data_stream = 1;
    FileIngestEvent file_ingest = 2;
  }
}

// An event signifying that data was streamed into a dataset.
message DataStreamEvent {
  // The original write batches requests containing the streamed data.
  repeated nominal.direct_channel_writer.v2.InternalWriteBatchesRequest write_batches_request = 1;
  // Timestamp when this event was created.
  nominal.types.time.Timestamp event_timestamp = 2;
}

// An event signifying that a file was ingested into a dataset.
message FileIngestEvent {
  // The RID of the dataset the file was ingested into.
  string dataset_rid = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.rids.DatasetRid"}];
  // The uuid of the ingested file.
  string file_id = 2 [(nominal.gen.v1.alias) = {java_name: "io.nominal.datasource.DatasetFileId"}];
  // Timestamp when this event was created.
  nominal.types.time.Timestamp event_timestamp = 3;
  // JSON-serialized IngestRequest from the original ingest. Empty for old events.
  bytes ingest_request = 4;
}
