// Copyright 2025 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.geminidataanalytics.v1beta;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/field_info.proto";
import "google/api/resource.proto";
import "google/cloud/geminidataanalytics/v1beta/data_agent.proto";
import "google/iam/v1/iam_policy.proto";
import "google/iam/v1/policy.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.GeminiDataAnalytics.V1Beta";
option go_package = "cloud.google.com/go/geminidataanalytics/apiv1beta/geminidataanalyticspb;geminidataanalyticspb";
option java_multiple_files = true;
option java_outer_classname = "DataAgentServiceProto";
option java_package = "com.google.cloud.geminidataanalytics.v1beta";
option php_namespace = "Google\\Cloud\\GeminiDataAnalytics\\V1beta";
option ruby_package = "Google::Cloud::GeminiDataAnalytics::V1beta";

// Service describing handlers for resources.
service DataAgentService {
  option (google.api.default_host) = "geminidataanalytics.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists DataAgents in a given project and location.
  rpc ListDataAgents(ListDataAgentsRequest) returns (ListDataAgentsResponse) {
    option (google.api.http) = {
      get: "/v1beta/{parent=projects/*/locations/*}/dataAgents"
    };
    option (google.api.method_signature) = "parent";
  }

  // Lists DataAgents that are accessible to the caller in a given project and
  // location.
  rpc ListAccessibleDataAgents(ListAccessibleDataAgentsRequest)
      returns (ListAccessibleDataAgentsResponse) {
    option (google.api.http) = {
      get: "/v1beta/{parent=projects/*/locations/*}/dataAgents:listAccessible"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single DataAgent.
  rpc GetDataAgent(GetDataAgentRequest) returns (DataAgent) {
    option (google.api.http) = {
      get: "/v1beta/{name=projects/*/locations/*/dataAgents/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new DataAgent in a given project and location.
  rpc CreateDataAgent(CreateDataAgentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/dataAgents"
      body: "data_agent"
    };
    option (google.api.method_signature) = "parent,data_agent,data_agent_id";
    option (google.longrunning.operation_info) = {
      response_type: "DataAgent"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single DataAgent.
  rpc UpdateDataAgent(UpdateDataAgentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1beta/{data_agent.name=projects/*/locations/*/dataAgents/*}"
      body: "data_agent"
    };
    option (google.api.method_signature) = "data_agent,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "DataAgent"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single DataAgent.
  rpc DeleteDataAgent(DeleteDataAgentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta/{name=projects/*/locations/*/dataAgents/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets the IAM policy for DataAgent
  rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
      returns (google.iam.v1.Policy) {
    option (google.api.http) = {
      post: "/v1beta/{resource=projects/*/locations/*/dataAgents/*}:getIamPolicy"
      body: "*"
    };
    option (google.api.method_signature) = "resource";
  }

  // Sets the IAM policy for a DataAgent.
  rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
      returns (google.iam.v1.Policy) {
    option (google.api.http) = {
      post: "/v1beta/{resource=projects/*/locations/*/dataAgents/*}:setIamPolicy"
      body: "*"
    };
    option (google.api.method_signature) = "resource";
  }
}

// Message for requesting list of DataAgents.
message ListDataAgentsRequest {
  // Required. Parent value for ListDataAgentsRequest.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "geminidataanalytics.googleapis.com/DataAgent"
    }
  ];

  // Optional. Server may return fewer items than requested.
  // If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token, received from a previous `ListDataAgents` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListDataAgents` must
  // match the call that provided the page token. The service may return fewer
  // than this value.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filtering results. See [AIP-160](https://google.aip.dev/160) for
  // syntax.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User specification for how to order the results.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. If true, the list results will include soft-deleted DataAgents.
  // Defaults to false.
  bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Message for response to listing DataAgents.
message ListDataAgentsResponse {
  // The list of DataAgent.
  repeated DataAgent data_agents = 1;

  // The next page token or empty if none.
  string next_page_token = 2;

  // Unordered list. Locations that could not be reached.
  repeated string unreachable = 3
      [(google.api.field_behavior) = UNORDERED_LIST];
}

// Message for requesting list of accessible DataAgents.
message ListAccessibleDataAgentsRequest {
  // Filter for the creator of the agent.
  enum CreatorFilter {
    // Default value.
    CREATOR_FILTER_UNSPECIFIED = 0;

    // No creator-specific filter will be applied. All agents will be returned.
    NONE = 1;

    // Only agents created by the user calling the API will be returned.
    CREATOR_ONLY = 2;

    // Only agents not created by the user calling the API will be returned.
    NOT_CREATOR_ONLY = 3;
  }

  // Required. Parent value for ListAccessibleDataAgentsRequest.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "geminidataanalytics.googleapis.com/DataAgent"
    }
  ];

  // Optional. Server may return fewer items than requested.
  // If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token, received from a previous `ListAccessibleDataAgents`
  // call. Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to
  // `ListAccessibleDataAgents` must match the call that provided the page
  // token. The service may return fewer than this value.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filtering results. See [AIP-160](https://google.aip.dev/160) for
  // syntax.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User specification for how to order the results.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. If true, the list results will include soft-deleted DataAgents.
  // Defaults to false.
  bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter for the creator of the agent.
  CreatorFilter creator_filter = 7 [(google.api.field_behavior) = OPTIONAL];
}

// Message for response to listing accessible DataAgents.
message ListAccessibleDataAgentsResponse {
  // The list of accessible DataAgent.
  repeated DataAgent data_agents = 1;

  // The next page token or empty if none.
  string next_page_token = 2;

  // Unordered list. Locations that could not be reached.
  repeated string unreachable = 3
      [(google.api.field_behavior) = UNORDERED_LIST];
}

// Message for getting a DataAgent.
message GetDataAgentRequest {
  // Required. Name of the resource.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "geminidataanalytics.googleapis.com/DataAgent"
    }
  ];
}

// Message for creating a DataAgent.
message CreateDataAgentRequest {
  // Required. Value for parent.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "geminidataanalytics.googleapis.com/DataAgent"
    }
  ];

  // Optional. Id of the requesting object. Must be unique within the parent.
  // The allowed format is: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
  // If not provided, the server will auto-generate a value for the id.
  string data_agent_id = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource being created.
  DataAgent data_agent = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 4 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Message for updating a DataAgent.
message UpdateDataAgentRequest {
  // Optional. Field mask is used to specify the fields to be overwritten in the
  // DataAgent resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields with non-default values
  // present in the request will be overwritten. If a wildcard mask is provided,
  // all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource being updated.
  DataAgent data_agent = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 3 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Message for deleting a DataAgent.
message DeleteDataAgentRequest {
  // Required. Name of the resource.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "geminidataanalytics.googleapis.com/DataAgent"
    }
  ];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes after the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 2 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Represents the metadata of the long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Server-defined resource path for the target of the operation.
  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Name of the verb executed by the operation.
  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Human-readable status of the operation, if any.
  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifies whether the user has requested cancellation
  // of the operation. Operations that have been cancelled successfully
  // have [Operation.error][] value with a
  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
  // `Code.CANCELLED`.
  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. API version used to start the operation.
  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}
