syntax = "proto3";

package nominal.ingest.v2;

import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";
import "nominal/protos/gen/v1/alias.proto";
import "nominal/protos/ingest/v2/common.proto";

option java_multiple_files = true;
option java_package = "io.nominal.ingest.v2";

// Dataset-file-backed video ingest work.
message VideoIngestItem {
  IngestSource source = 1 [(buf.validate.field).required = true];
  VideoIngestOptions ingest = 2 [(buf.validate.field).required = true];
}

message VideoIngestOptions {
  VideoTimestampManifest timestamp_manifest = 1 [(buf.validate.field).required = true];
  string channel = 2 [
    (buf.validate.field).required = true,
    (nominal.gen.v1.alias) = {java_name: "io.nominal.api.Channel"}
  ];
  optional bool overwrite_segments = 3;
}

message VideoTimestampManifest {
  oneof manifest {
    option (buf.validate.oneof) = {required: true};

    NoTimestampManifest no_manifest = 1;
    TimestampManifestFiles timestamp_manifest_files = 2;
  }
}

message NoTimestampManifest {
  google.protobuf.Timestamp starting_timestamp = 1 [(buf.validate.field).required = true];
  optional ScaleParameter scale_parameter = 2;
}

message TimestampManifestFiles {
  repeated IngestSource sources = 1 [(buf.validate.field).repeated.min_items = 1];
}

message ScaleParameter {
  oneof scale_parameter {
    option (buf.validate.oneof) = {required: true};

    double true_frame_rate = 1;
    google.protobuf.Timestamp ending_timestamp = 2;
    double scale_factor = 3;
  }
}
