// 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.aiplatform.v1beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/aiplatform/v1beta1/online_evaluator.proto";
import "google/cloud/aiplatform/v1beta1/operation.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
option java_multiple_files = true;
option java_outer_classname = "OnlineEvaluatorServiceProto";
option java_package = "com.google.cloud.aiplatform.v1beta1";
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";

// This service is used to create and manage Vertex AI OnlineEvaluators.
service OnlineEvaluatorService {
  option (google.api.default_host) = "aiplatform.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Creates an OnlineEvaluator in the given project and location.
  rpc CreateOnlineEvaluator(CreateOnlineEvaluatorRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/onlineEvaluators"
      body: "online_evaluator"
    };
    option (google.api.method_signature) = "parent,online_evaluator";
    option (google.longrunning.operation_info) = {
      response_type: "OnlineEvaluator"
      metadata_type: "CreateOnlineEvaluatorOperationMetadata"
    };
  }

  // Gets details of an OnlineEvaluator.
  rpc GetOnlineEvaluator(GetOnlineEvaluatorRequest) returns (OnlineEvaluator) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates the fields of an OnlineEvaluator.
  rpc UpdateOnlineEvaluator(UpdateOnlineEvaluatorRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1beta1/{online_evaluator.name=projects/*/locations/*/onlineEvaluators/*}"
      body: "online_evaluator"
    };
    option (google.api.method_signature) = "online_evaluator,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "OnlineEvaluator"
      metadata_type: "UpdateOnlineEvaluatorOperationMetadata"
    };
  }

  // Deletes an OnlineEvaluator.
  rpc DeleteOnlineEvaluator(DeleteOnlineEvaluatorRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteOnlineEvaluatorOperationMetadata"
    };
  }

  // Lists the OnlineEvaluators for the given project and location.
  rpc ListOnlineEvaluators(ListOnlineEvaluatorsRequest)
      returns (ListOnlineEvaluatorsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/onlineEvaluators"
    };
    option (google.api.method_signature) = "parent";
  }

  // Activates an OnlineEvaluator.
  rpc ActivateOnlineEvaluator(ActivateOnlineEvaluatorRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}:activate"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "OnlineEvaluator"
      metadata_type: "ActivateOnlineEvaluatorOperationMetadata"
    };
  }

  // Suspends an OnlineEvaluator. When an OnlineEvaluator is suspended, it won't
  // run any evaluations until it is activated again.
  rpc SuspendOnlineEvaluator(SuspendOnlineEvaluatorRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/onlineEvaluators/*}:suspend"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "OnlineEvaluator"
      metadata_type: "SuspendOnlineEvaluatorOperationMetadata"
    };
  }
}

// Request message for CreateOnlineEvaluator.
message CreateOnlineEvaluatorRequest {
  // Required. The parent resource where the OnlineEvaluator will be created.
  // Format: projects/{project}/locations/{location}.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Required. The OnlineEvaluator to create.
  OnlineEvaluator online_evaluator = 2 [(google.api.field_behavior) = REQUIRED];
}

// Metadata for the CreateOnlineEvaluator operation.
message CreateOnlineEvaluatorOperationMetadata {
  // Common part of operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for GetOnlineEvaluator.
message GetOnlineEvaluatorRequest {
  // Required. The name of the OnlineEvaluator to retrieve.
  // Format: projects/{project}/locations/{location}/onlineEvaluators/{id}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/OnlineEvaluator"
    }
  ];
}

// Request message for UpdateOnlineEvaluator.
message UpdateOnlineEvaluatorRequest {
  // Required. The OnlineEvaluator to update.
  // Format: projects/{project}/locations/{location}/onlineEvaluators/{id}.
  OnlineEvaluator online_evaluator = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Field mask is used to control which fields get updated. If the
  // mask is not present, all fields will be updated.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Metadata for the UpdateOnlineEvaluator operation.
message UpdateOnlineEvaluatorOperationMetadata {
  // Generic operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for DeleteOnlineEvaluator.
message DeleteOnlineEvaluatorRequest {
  // Required. The name of the OnlineEvaluator to delete.
  // Format: projects/{project}/locations/{location}/onlineEvaluators/{id}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/OnlineEvaluator"
    }
  ];
}

// Metadata for the DeleteOnlineEvaluator operation.
message DeleteOnlineEvaluatorOperationMetadata {
  // Generic operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for ListOnlineEvaluators.
message ListOnlineEvaluatorsRequest {
  // Required. The parent resource of the OnlineEvaluators to list.
  // Format: projects/{project}/locations/{location}.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "aiplatform.googleapis.com/OnlineEvaluator"
    }
  ];

  // Optional. The maximum number of OnlineEvaluators to return. The service may
  // return fewer than this value. If unspecified, at most 50 OnlineEvaluators
  // will be returned. The maximum value is 100; values above 100 will be
  // coerced to 100. Based on aip.dev/158.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  // Based on aip.dev/158.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Standard list filter.
  // Supported fields:
  //    * `create_time`
  //    * `update_time`
  //    * `agent_resource`
  // Example: `create_time>"2026-01-01T00:00:00-04:00"`
  //    where the timestamp is in RFC 3339 format)
  // Based on aip.dev/160.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A comma-separated list of fields to order by. The default sorting
  // order is ascending. Use "desc" after a field name for descending. Supported
  // fields:
  //   * `create_time`
  //   * `update_time`
  //
  // Example: `create_time desc`.
  // Based on aip.dev/132.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for ListOnlineEvaluators.
message ListOnlineEvaluatorsResponse {
  // A list of OnlineEvaluators matching the request.
  repeated OnlineEvaluator online_evaluators = 1;

  // A token to retrieve the next page. Absence of this field indicates there
  // are no subsequent pages.
  string next_page_token = 2;
}

// Request message for ActivateOnlineEvaluator.
message ActivateOnlineEvaluatorRequest {
  // Required. The name of the OnlineEvaluator to activate.
  // Format: projects/{project}/locations/{location}/onlineEvaluators/{id}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/OnlineEvaluator"
    }
  ];
}

// Metadata for the ActivateOnlineEvaluator operation.
message ActivateOnlineEvaluatorOperationMetadata {
  // Common part of operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}

// Request message for SuspendOnlineEvaluator.
message SuspendOnlineEvaluatorRequest {
  // Required. The name of the OnlineEvaluator to suspend.
  // Format: projects/{project}/locations/{location}/onlineEvaluators/{id}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/OnlineEvaluator"
    }
  ];
}

// Metadata for the SuspendOnlineEvaluator operation.
message SuspendOnlineEvaluatorOperationMetadata {
  // Common part of operation metadata.
  GenericOperationMetadata generic_metadata = 1;
}
