syntax = "proto3";

package nominal.workspaces.v1;

import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "nominal/protos/gen/v1/alias.proto";

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

// Metadata associated with a workspace that is not part of the core workspace definition.
message WorkspaceMetadata {
  // The RID of the usage tracking dataset for this workspace, if configured.
  optional string usage_dataset_rid = 1 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.rids.DatasetRid"}];
  // The RID of the log dataset for this workspace, if configured.
  optional string log_dataset_rid = 2 [(nominal.gen.v1.alias) = {java_name: "io.nominal.api.rids.DatasetRid"}];
}

// Request to get workspace metadata.
message GetWorkspaceMetadataRequest {
  string workspace_rid = 1 [
    (nominal.gen.v1.alias) = {java_name: "io.nominal.api.rids.WorkspaceRid"},
    (buf.validate.field) = {required: true}
  ];
}

// Response containing workspace metadata.
message GetWorkspaceMetadataResponse {
  WorkspaceMetadata metadata = 1;
}

// Service for accessing workspace metadata.
service WorkspaceMetadataService {
  // Gets metadata for the specified workspace, including the log and usage tracking dataset RIDs if configured.
  rpc GetWorkspaceMetadata(GetWorkspaceMetadataRequest) returns (GetWorkspaceMetadataResponse) {
    option (google.api.http) = {
      get: "/workspaces/v1/workspaces/{workspace_rid}/metadata"
      response_body: "metadata"
    };
  }
}
