// This proto file was generated from global.yml.
// Care should be taken while both files exist to maintain backwards compatibility with the Conjure generated code.

syntax = "proto3";

// Ignore buf linting rule that adds version suffix for shared global types
// buf:lint:ignore PACKAGE_VERSION_SUFFIX
package nominal.types;

import "buf/validate/validate.proto";
import "nominal/protos/conjure/v1/compat.proto";
import "nominal/protos/gen/v1/alias.proto";

option java_multiple_files = true;
option java_package = "io.nominal.types";

// buf:lint:ignore ENUM_VALUE_PREFIX
enum ArchivedStatus {
  ARCHIVED_STATUS_UNSPECIFIED = 0;
  NOT_ARCHIVED = 1;
  ARCHIVED = 2;
}

// buf:lint:ignore ENUM_VALUE_PREFIX
enum DataSourceType {
  DATA_SOURCE_TYPE_UNSPECIFIED = 0;
  DATASET = 1;
  CONNECTION = 2;
  VIDEO = 3;
}

message Empty {}

message ErrorResult {
  string error_type = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.ErrorType"}];

  string message = 2;
}

// buf:lint:ignore ENUM_VALUE_PREFIX
enum Granularity {
  GRANULARITY_UNSPECIFIED = 0;
  NANOSECONDS = 2;
}

message Handle {
  option (nominal.conjure.v1.conjure_compat) = {union_message: true};

  oneof handle {
    option (buf.validate.oneof) = {required: true};

    string s3 = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.S3Path"}];
  }
}

message InProgressResult {}

// buf:lint:ignore ENUM_VALUE_PREFIX
enum IngestStatus {
  INGEST_STATUS_UNSPECIFIED = 0;
  SUCCEEDED = 1;
  FAILED = 2;
  IN_PROGRESS = 3;
  DELETION_IN_PROGRESS = 4;
  DELETED = 5;
}

message IngestStatusV2 {
  option (nominal.conjure.v1.conjure_compat) = {union_message: true};

  oneof ingest_status_v2 {
    option (buf.validate.oneof) = {required: true};

    SuccessResult success = 1;
    ErrorResult error = 2;
    InProgressResult in_progress = 3;
  }
}

// Locator for a channel in an mcap file. Channel name is not guaranteed to be unique, so channel ID should
// be used for mcap files with duplicate channel names.
message McapChannelLocator {
  option (nominal.conjure.v1.conjure_compat) = {union_message: true};

  // Locator for a channel in an mcap file. Channel name is not guaranteed to be unique, so channel ID should
  // be used for mcap files with duplicate channel names.
  oneof mcap_channel_locator {
    option (buf.validate.oneof) = {required: true};

    string topic = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.McapChannelTopic"}];
    int32 id = 2 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.McapChannelId"}];
  }
}

message Property {
  string name = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.PropertyName"}];

  string value = 2 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.PropertyValue"}];
}

// Wrapper classes to allow for optional fields on update requests
message LabelUpdateWrapper {
  repeated string labels = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.Label"}];
}

message PropertyUpdateWrapper {
  map<string, string> properties = 1 [(nominal.gen.v1.alias) = {
    key_java_name: "io.nominal.api.PropertyName"
    value_java_name: "io.nominal.api.PropertyValue"
  }];
}

message RefNameAndType {
  string name = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.DataSourceRefName"}];

  DataSourceType type = 2;
}

// A SerializableError is a representation of a ServiceException that exists to send error
// results to clients as part of a response object when directly throwing an exception is undesirable.
message SerializableError {
  string name = 1;

  optional string message = 2;

  string error_instance_id = 3;

  int32 status_code = 4;

  map<string, string> params = 5;
}

message SuccessResult {}

// The data types supported by Nominal's database.
//
// buf:lint:ignore ENUM_VALUE_PREFIX
enum NominalDataType {
  NOMINAL_DATA_TYPE_UNSPECIFIED = 0;
  DOUBLE = 1;
  STRING = 2;
  LOG = 3;
  INT64 = 4;
}
