// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.vectorsearch.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/vectorsearch/v1/data_object.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.VectorSearch.V1";
option go_package = "cloud.google.com/go/vectorsearch/apiv1/vectorsearchpb;vectorsearchpb";
option java_multiple_files = true;
option java_outer_classname = "DataObjectServiceProto";
option java_package = "com.google.cloud.vectorsearch.v1";
option php_namespace = "Google\\Cloud\\VectorSearch\\V1";
option ruby_package = "Google::Cloud::VectorSearch::V1";

// Service for creating and managing data objects.
service DataObjectService {
  option (google.api.default_host) = "vectorsearch.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Creates a dataObject.
  rpc CreateDataObject(CreateDataObjectRequest) returns (DataObject) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/collections/*}/dataObjects"
      body: "data_object"
    };
    option (google.api.method_signature) = "parent,data_object,data_object_id";
  }

  // Creates a batch of dataObjects.
  rpc BatchCreateDataObjects(BatchCreateDataObjectsRequest)
      returns (BatchCreateDataObjectsResponse) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/collections/*}/dataObjects:batchCreate"
      body: "*"
    };
  }

  // Gets a data object.
  rpc GetDataObject(GetDataObjectRequest) returns (DataObject) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/collections/*/dataObjects/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates a dataObject.
  rpc UpdateDataObject(UpdateDataObjectRequest) returns (DataObject) {
    option (google.api.http) = {
      patch: "/v1/{data_object.name=projects/*/locations/*/collections/*/dataObjects/*}"
      body: "data_object"
    };
    option (google.api.method_signature) = "data_object,update_mask";
  }

  // Updates dataObjects in a batch.
  rpc BatchUpdateDataObjects(BatchUpdateDataObjectsRequest)
      returns (BatchUpdateDataObjectsResponse) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/collections/*}/dataObjects:batchUpdate"
      body: "*"
    };
    option (google.api.method_signature) = "parent,requests";
  }

  // Deletes a dataObject.
  rpc DeleteDataObject(DeleteDataObjectRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/collections/*/dataObjects/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Deletes dataObjects in a batch.
  rpc BatchDeleteDataObjects(BatchDeleteDataObjectsRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/collections/*}/dataObjects:batchDelete"
      body: "*"
    };
    option (google.api.method_signature) = "parent,requests";
  }
}

// Request message for
// [DataObjectService.CreateDataObject][google.cloud.vectorsearch.v1.DataObjectService.CreateDataObject].
message CreateDataObjectRequest {
  // Required. The resource name of the Collection to create the DataObject in.
  // Format: `projects/{project}/locations/{location}/collections/{collection}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/Collection"
    }
  ];

  // Required. The id of the dataObject to create.
  // The id must be 1-63 characters long, and comply with
  // [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
  // Specifically, it must be 1-63 characters long and match the regular
  // expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
  string data_object_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The DataObject to create.
  DataObject data_object = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request message for
// [DataObjectService.BatchCreateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects].
message BatchCreateDataObjectsRequest {
  // Required. The resource name of the Collection to create the DataObjects in.
  // Format: `projects/{project}/locations/{location}/collections/{collection}`.
  // The parent field in the CreateDataObjectRequest messages must match this
  // field.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/Collection"
    }
  ];

  // Required. The request message specifying the resources to create.
  // A maximum of 1000 DataObjects can be created in a batch.
  repeated CreateDataObjectRequest requests = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Response message for
// [DataObjectService.BatchCreateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects].
message BatchCreateDataObjectsResponse {
  // Output only. DataObjects created.
  repeated DataObject data_objects = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for
// [DataObjectService.GetDataObject][google.cloud.vectorsearch.v1.DataObjectService.GetDataObject].
message GetDataObjectRequest {
  // Required. The name of the DataObject resource.
  // Format:
  // `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/DataObject"
    }
  ];
}

// Request message for
// [DataObjectService.UpdateDataObject][google.cloud.vectorsearch.v1.DataObjectService.UpdateDataObject].
message UpdateDataObjectRequest {
  // Required. The DataObject which replaces the resource on the server.
  DataObject data_object = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The update mask applies to the resource. See
  // [google.protobuf.FieldMask][google.protobuf.FieldMask].
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [DataObjectService.BatchUpdateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects].
message BatchUpdateDataObjectsRequest {
  // Required. The resource name of the Collection to update the DataObjects in.
  // Format: `projects/{project}/locations/{location}/collections/{collection}`.
  // The parent field in the UpdateDataObjectRequest messages must match this
  // field.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/Collection"
    }
  ];

  // Required. The request message specifying the resources to update.
  // A maximum of 1000 DataObjects can be updated in a batch.
  repeated UpdateDataObjectRequest requests = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Response message for
// [DataObjectService.BatchUpdateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects].
message BatchUpdateDataObjectsResponse {}

// Request message for
// [DataObjectService.DeleteDataObject][google.cloud.vectorsearch.v1.DataObjectService.DeleteDataObject].
message DeleteDataObjectRequest {
  // Required. The name of the DataObject resource to be deleted.
  // Format:
  // `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/DataObject"
    }
  ];

  // Optional. The current etag of the DataObject.
  // If an etag is provided and does not match the current etag of the
  // DataObject, deletion will be blocked and an ABORTED error will be returned.
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [DataObjectService.BatchDeleteDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchDeleteDataObjects].
message BatchDeleteDataObjectsRequest {
  // Required. The resource name of the Collection to delete the DataObjects in.
  // Format: `projects/{project}/locations/{location}/collections/{collection}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "vectorsearch.googleapis.com/Collection"
    }
  ];

  // Required. The request message specifying the resources to delete.
  // A maximum of 1000 DataObjects can be deleted in a batch.
  repeated DeleteDataObjectRequest requests = 3
      [(google.api.field_behavior) = REQUIRED];
}
