// 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.ces.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/ces/v1/agent.proto";
import "google/cloud/ces/v1/app.proto";
import "google/cloud/ces/v1/app_version.proto";
import "google/cloud/ces/v1/changelog.proto";
import "google/cloud/ces/v1/conversation.proto";
import "google/cloud/ces/v1/deployment.proto";
import "google/cloud/ces/v1/example.proto";
import "google/cloud/ces/v1/guardrail.proto";
import "google/cloud/ces/v1/tool.proto";
import "google/cloud/ces/v1/toolset.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option go_package = "cloud.google.com/go/ces/apiv1/cespb;cespb";
option java_multiple_files = true;
option java_outer_classname = "AgentServiceProto";
option java_package = "com.google.cloud.ces.v1";
option (google.api.resource_definition) = {
  type: "contactcenterinsights.googleapis.com/Dataset"
  pattern: "projects/{project}/locations/{location}/datasets/{dataset}"
};

// The service that manages agent-related resources in Gemini Enterprise for
// Customer Engagement (CES).
service AgentService {
  option (google.api.default_host) = "ces.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/ces,"
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists apps in the given project and location.
  rpc ListApps(ListAppsRequest) returns (ListAppsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/apps"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified app.
  rpc GetApp(GetAppRequest) returns (App) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new app in the given project and location.
  rpc CreateApp(CreateAppRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/apps"
      body: "app"
    };
    option (google.api.method_signature) = "parent,app,app_id";
    option (google.api.method_signature) = "parent,app";
    option (google.longrunning.operation_info) = {
      response_type: "App"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the specified app.
  rpc UpdateApp(UpdateAppRequest) returns (App) {
    option (google.api.http) = {
      patch: "/v1/{app.name=projects/*/locations/*/apps/*}"
      body: "app"
    };
    option (google.api.method_signature) = "app,update_mask";
  }

  // Deletes the specified app.
  rpc DeleteApp(DeleteAppRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Exports the specified app.
  rpc ExportApp(ExportAppRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/apps/*}:exportApp"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "ExportAppResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Imports the specified app.
  rpc ImportApp(ImportAppRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/apps:importApp"
      body: "*"
    };
    option (google.api.method_signature) = "parent,display_name,app_id";
    option (google.longrunning.operation_info) = {
      response_type: "ImportAppResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists agents in the given app.
  rpc ListAgents(ListAgentsRequest) returns (ListAgentsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/agents"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified agent.
  rpc GetAgent(GetAgentRequest) returns (Agent) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/agents/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new agent in the given app.
  rpc CreateAgent(CreateAgentRequest) returns (Agent) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/agents"
      body: "agent"
    };
    option (google.api.method_signature) = "parent,agent,agent_id";
    option (google.api.method_signature) = "parent,agent";
  }

  // Updates the specified agent.
  rpc UpdateAgent(UpdateAgentRequest) returns (Agent) {
    option (google.api.http) = {
      patch: "/v1/{agent.name=projects/*/locations/*/apps/*/agents/*}"
      body: "agent"
    };
    option (google.api.method_signature) = "agent,update_mask";
  }

  // Deletes the specified agent.
  rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/agents/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists examples in the given app.
  rpc ListExamples(ListExamplesRequest) returns (ListExamplesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/examples"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified example.
  rpc GetExample(GetExampleRequest) returns (Example) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/examples/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new example in the given app.
  rpc CreateExample(CreateExampleRequest) returns (Example) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/examples"
      body: "example"
    };
    option (google.api.method_signature) = "parent,example,example_id";
    option (google.api.method_signature) = "parent,example";
  }

  // Updates the specified example.
  rpc UpdateExample(UpdateExampleRequest) returns (Example) {
    option (google.api.http) = {
      patch: "/v1/{example.name=projects/*/locations/*/apps/*/examples/*}"
      body: "example"
    };
    option (google.api.method_signature) = "example,update_mask";
  }

  // Deletes the specified example.
  rpc DeleteExample(DeleteExampleRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/examples/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists tools in the given app.
  rpc ListTools(ListToolsRequest) returns (ListToolsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/tools"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified tool.
  rpc GetTool(GetToolRequest) returns (Tool) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/tools/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists conversations in the given app.
  rpc ListConversations(ListConversationsRequest)
      returns (ListConversationsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/conversations"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified conversation.
  rpc GetConversation(GetConversationRequest) returns (Conversation) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/conversations/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Deletes the specified conversation.
  rpc DeleteConversation(DeleteConversationRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/conversations/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Batch deletes the specified conversations.
  rpc BatchDeleteConversations(BatchDeleteConversationsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/conversations:batchDelete"
      body: "*"
    };
    option (google.api.method_signature) = "parent";
    option (google.longrunning.operation_info) = {
      response_type: "BatchDeleteConversationsResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Creates a new tool in the given app.
  rpc CreateTool(CreateToolRequest) returns (Tool) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/tools"
      body: "tool"
    };
    option (google.api.method_signature) = "parent,tool,tool_id";
    option (google.api.method_signature) = "parent,tool";
  }

  // Updates the specified tool.
  rpc UpdateTool(UpdateToolRequest) returns (Tool) {
    option (google.api.http) = {
      patch: "/v1/{tool.name=projects/*/locations/*/apps/*/tools/*}"
      body: "tool"
    };
    option (google.api.method_signature) = "tool,update_mask";
  }

  // Deletes the specified tool.
  rpc DeleteTool(DeleteToolRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/tools/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists guardrails in the given app.
  rpc ListGuardrails(ListGuardrailsRequest) returns (ListGuardrailsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/guardrails"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified guardrail.
  rpc GetGuardrail(GetGuardrailRequest) returns (Guardrail) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/guardrails/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new guardrail in the given app.
  rpc CreateGuardrail(CreateGuardrailRequest) returns (Guardrail) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/guardrails"
      body: "guardrail"
    };
    option (google.api.method_signature) = "parent,guardrail,guardrail_id";
    option (google.api.method_signature) = "parent,guardrail";
  }

  // Updates the specified guardrail.
  rpc UpdateGuardrail(UpdateGuardrailRequest) returns (Guardrail) {
    option (google.api.http) = {
      patch: "/v1/{guardrail.name=projects/*/locations/*/apps/*/guardrails/*}"
      body: "guardrail"
    };
    option (google.api.method_signature) = "guardrail,update_mask";
  }

  // Deletes the specified guardrail.
  rpc DeleteGuardrail(DeleteGuardrailRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/guardrails/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists deployments in the given app.
  rpc ListDeployments(ListDeploymentsRequest)
      returns (ListDeploymentsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/deployments"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified deployment.
  rpc GetDeployment(GetDeploymentRequest) returns (Deployment) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/deployments/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new deployment in the given app.
  rpc CreateDeployment(CreateDeploymentRequest) returns (Deployment) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/deployments"
      body: "deployment"
    };
    option (google.api.method_signature) = "parent,deployment,deployment_id";
    option (google.api.method_signature) = "parent,deployment";
  }

  // Updates the specified deployment.
  rpc UpdateDeployment(UpdateDeploymentRequest) returns (Deployment) {
    option (google.api.http) = {
      patch: "/v1/{deployment.name=projects/*/locations/*/apps/*/deployments/*}"
      body: "deployment"
    };
    option (google.api.method_signature) = "deployment,update_mask";
  }

  // Deletes the specified deployment.
  rpc DeleteDeployment(DeleteDeploymentRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/deployments/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists toolsets in the given app.
  rpc ListToolsets(ListToolsetsRequest) returns (ListToolsetsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/toolsets"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified toolset.
  rpc GetToolset(GetToolsetRequest) returns (Toolset) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/toolsets/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new toolset in the given app.
  rpc CreateToolset(CreateToolsetRequest) returns (Toolset) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/toolsets"
      body: "toolset"
    };
    option (google.api.method_signature) = "parent,toolset,toolset_id";
    option (google.api.method_signature) = "parent,toolset";
  }

  // Updates the specified toolset.
  rpc UpdateToolset(UpdateToolsetRequest) returns (Toolset) {
    option (google.api.http) = {
      patch: "/v1/{toolset.name=projects/*/locations/*/apps/*/toolsets/*}"
      body: "toolset"
    };
    option (google.api.method_signature) = "toolset,update_mask";
  }

  // Deletes the specified toolset.
  rpc DeleteToolset(DeleteToolsetRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/toolsets/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists all app versions in the given app.
  rpc ListAppVersions(ListAppVersionsRequest)
      returns (ListAppVersionsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/versions"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of the specified app version.
  rpc GetAppVersion(GetAppVersionRequest) returns (AppVersion) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/versions/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new app version in the given app.
  rpc CreateAppVersion(CreateAppVersionRequest) returns (AppVersion) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/apps/*}/versions"
      body: "app_version"
    };
    option (google.api.method_signature) = "parent,app_version,app_version_id";
    option (google.api.method_signature) = "parent,app_version";
  }

  // Deletes the specified app version.
  rpc DeleteAppVersion(DeleteAppVersionRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/apps/*/versions/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Restores the specified app version.
  // This will create a new app version from the current draft app and overwrite
  // the current draft with the specified app version.
  rpc RestoreAppVersion(RestoreAppVersionRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/apps/*/versions/*}:restore"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "RestoreAppVersionResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists the changelogs of the specified app.
  rpc ListChangelogs(ListChangelogsRequest) returns (ListChangelogsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/apps/*}/changelogs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets the specified changelog.
  rpc GetChangelog(GetChangelogRequest) returns (Changelog) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/apps/*/changelogs/*}"
    };
    option (google.api.method_signature) = "name";
  }
}

// Request message for
// [AgentService.ListApps][google.cloud.ces.v1.AgentService.ListApps].
message ListAppsRequest {
  // Required. The resource name of the location to list apps from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/App" }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListAppsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListApps][google.cloud.ces.v1.AgentService.ListApps] call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the apps.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListApps][google.cloud.ces.v1.AgentService.ListApps].
message ListAppsResponse {
  // The list of apps.
  repeated App apps = 1;

  // A token that can be sent as
  // [ListAppsRequest.page_token][google.cloud.ces.v1.ListAppsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;

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

// Request message for
// [AgentService.GetApp][google.cloud.ces.v1.AgentService.GetApp].
message GetAppRequest {
  // Required. The resource name of the app to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/App" }
  ];
}

// Request message for
// [AgentService.CreateApp][google.cloud.ces.v1.AgentService.CreateApp].
message CreateAppRequest {
  // Required. The resource name of the location to create an app in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/App" }
  ];

  // Optional. The ID to use for the app, which will become the final component
  // of the app's resource name. If not provided, a unique ID will be
  // automatically assigned for the app.
  string app_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateApp][google.cloud.ces.v1.AgentService.UpdateApp].
message UpdateAppRequest {
  // Required. The app to update.
  App app = 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];
}

// Request message for
// [AgentService.DeleteApp][google.cloud.ces.v1.AgentService.DeleteApp].
message DeleteAppRequest {
  // Required. The resource name of the app to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/App" }
  ];

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

// Request message for
// [AgentService.ExportApp][google.cloud.ces.v1.AgentService.ExportApp].
message ExportAppRequest {
  // Export format for the app.
  enum ExportFormat {
    // The export format is unspecified.
    EXPORT_FORMAT_UNSPECIFIED = 0;

    // The export format is JSON.
    JSON = 1;

    // The export format is YAML.
    YAML = 2;
  }

  // Required. The resource name of the app to export.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/App" }
  ];

  // Required. The format to export the app in.
  ExportFormat export_format = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. The [Google Cloud
  // Storage](https://cloud.google.com/storage/docs/) URI to which to export the
  // app. The format of this URI must be `gs://<bucket-name>/<object-name>`. The
  // exported app archive will be written directly to the specified GCS object.
  string gcs_uri = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The resource name of the app version to export.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}/versions/{version}`.
  string app_version = 4 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = { type: "ces.googleapis.com/AppVersion" }
  ];
}

// Response message for
// [AgentService.ExportApp][google.cloud.ces.v1.AgentService.ExportApp].
message ExportAppResponse {
  // The exported app.
  oneof app {
    // App folder compressed as a zip file.
    bytes app_content = 1;

    // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
    // to which the app was exported.
    string app_uri = 2;
  }
}

// Request message for
// [AgentService.ImportApp][google.cloud.ces.v1.AgentService.ImportApp].
message ImportAppRequest {
  // Configuration options for the app import process.
  // These options control how the import behaves, particularly when
  // conflicts arise with existing app data.
  message ImportOptions {
    // Defines the strategy for handling conflicts when an app with the same ID
    // already exists, or when imported resources (like Agents, Tools, etc.)
    // have the same display names as existing resources within that app.
    enum ConflictResolutionStrategy {
      // The conflict resolution strategy is unspecified.
      CONFLICT_RESOLUTION_STRATEGY_UNSPECIFIED = 0;

      // Replace existing data with imported data.
      // If an app with the same `app_id` already exists, its content will be
      // updated based on the imported app.
      // - Resources (App, Agents, Tools, Examples, Guardrails, Toolsets) in the
      //   imported app that have the same display name as existing resources
      //   will overwrite the existing ones.
      // - Imported resources with new display names will be created.
      // - Existing resources that do not have a matching display name in the
      //   imported app will remain untouched.
      REPLACE = 1;

      // Overwrite existing data with imported data.
      // If an app with the same `app_id` already exists, its content will be
      // overwritten with the imported app.
      // - Existing resources (Agents, Tools, Examples, Guardrails, Toolsets) in
      //   the app will be deleted.
      // - Imported resources will be created as new resources.
      OVERWRITE = 2;
    }

    // Optional. The strategy to use when resolving conflicts during import.
    ConflictResolutionStrategy conflict_resolution_strategy = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // The app to import.
  oneof app {
    // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
    // from which to import app. The format of this URI must be
    // `gs://<bucket-name>/<object-name>`.
    string gcs_uri = 4;

    // Raw bytes representing the compressed zip file with the app folder
    // structure.
    bytes app_content = 5;
  }

  // Required. The parent resource name with the location of the app to import.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/App" }
  ];

  // Optional. The display name of the app to import.
  // * If the app is created on import, and the display name is specified,
  // the imported app will use this display name. If a conflict is detected
  // with an existing app, a timestamp will be appended to the display name
  // to make it unique.
  // * If the app is a reimport, this field should not be set. Providing a
  // display name during reimport will result in an INVALID_ARGUMENT error.
  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The ID to use for the imported app.
  // *  If not specified, a unique ID will be automatically assigned for
  // the app.
  // *  Otherwise, the imported app will use this ID as the final component of
  // its resource name. If an app with the same ID already exists at the
  // specified location in the project, the content of the existing app will be
  // replaced.
  string app_id = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Options governing the import process for the app.
  ImportOptions import_options = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Flag for overriding the app lock during import.
  // If set to true, the import process will ignore the app lock.
  bool ignore_app_lock = 7 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ImportApp][google.cloud.ces.v1.AgentService.ImportApp].
message ImportAppResponse {
  // The resource name of the app that was imported.
  string name = 1
      [(google.api.resource_reference) = { type: "ces.googleapis.com/App" }];

  // Warning messages generated during the import process.
  // If errors occur for specific resources, they will not be included in the
  // imported app and the error will be mentioned here.
  repeated string warnings = 2;
}

// Request message for
// [AgentService.ListAgents][google.cloud.ces.v1.AgentService.ListAgents].
message ListAgentsRequest {
  // Required. The resource name of the app to list agents from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/Agent" }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListAgentsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListAgents][google.cloud.ces.v1.AgentService.ListAgents]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the agents.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListAgents][google.cloud.ces.v1.AgentService.ListAgents].
message ListAgentsResponse {
  // The list of agents.
  repeated Agent agents = 1;

  // A token that can be sent as
  // [ListAgentsRequest.page_token][google.cloud.ces.v1.ListAgentsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetAgent][google.cloud.ces.v1.AgentService.GetAgent].
message GetAgentRequest {
  // Required. The resource name of the agent to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Agent" }
  ];
}

// Request message for
// [AgentService.CreateAgent][google.cloud.ces.v1.AgentService.CreateAgent].
message CreateAgentRequest {
  // Required. The resource name of the app to create an agent in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/Agent" }
  ];

  // Optional. The ID to use for the agent, which will become the final
  // component of the agent's resource name. If not provided, a unique ID will
  // be automatically assigned for the agent.
  string agent_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateAgent][google.cloud.ces.v1.AgentService.UpdateAgent].
message UpdateAgentRequest {
  // Required. The agent to update.
  Agent agent = 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];
}

// Request message for
// [AgentService.DeleteAgent][google.cloud.ces.v1.AgentService.DeleteAgent].
message DeleteAgentRequest {
  // Required. The resource name of the agent to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Agent" }
  ];

  // Optional. Indicates whether to forcefully delete the agent, even if it is
  // still referenced by other app/agents/examples.
  //
  // *  If `force = false`, the deletion fails if other agents/examples
  // reference it.
  // *  If `force = true`, delete the agent and remove it from all referencing
  // apps/agents/examples.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The current etag of the agent. If an etag is not provided, the
  // deletion will overwrite any concurrent changes. If an etag is provided and
  // does not match the current etag of the agent, deletion will be blocked and
  // an ABORTED error will be returned.
  string etag = 3 [(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. Human-readable status of the operation, if any.
  string status_message = 3 [(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
  // [google.longrunning.Operation.error][google.longrunning.Operation.error]
  // value with a [google.rpc.Status.code][google.rpc.Status.code] of `1`,
  // corresponding to `Code.CANCELLED`.
  bool requested_cancellation = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for
// [AgentService.ListExamples][google.cloud.ces.v1.AgentService.ListExamples].
message ListExamplesRequest {
  // Required. The resource name of the app to list examples from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Example"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListExamplesResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListExamples][google.cloud.ces.v1.AgentService.ListExamples]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the examples.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListExamples][google.cloud.ces.v1.AgentService.ListExamples].
message ListExamplesResponse {
  // The list of examples.
  repeated Example examples = 1;

  // A token that can be sent as
  // [ListExamplesRequest.page_token][google.cloud.ces.v1.ListExamplesRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetExample][google.cloud.ces.v1.AgentService.GetExample].
message GetExampleRequest {
  // Required. The resource name of the example to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Example" }
  ];
}

// Request message for
// [AgentService.CreateExample][google.cloud.ces.v1.AgentService.CreateExample].
message CreateExampleRequest {
  // Required. The resource name of the app to create an example in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Example"
    }
  ];

  // Optional. The ID to use for the example, which will become the final
  // component of the example's resource name. If not provided, a unique ID will
  // be automatically assigned for the example.
  string example_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateExample][google.cloud.ces.v1.AgentService.UpdateExample].
message UpdateExampleRequest {
  // Required. The example to update.
  Example example = 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];
}

// Request message for
// [AgentService.DeleteExample][google.cloud.ces.v1.AgentService.DeleteExample].
message DeleteExampleRequest {
  // Required. The resource name of the example to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Example" }
  ];

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

// Request message for
// [AgentService.ListTools][google.cloud.ces.v1.AgentService.ListTools].
message ListToolsRequest {
  // Required. The resource name of the app to list tools from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/Tool" }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListToolsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListTools][google.cloud.ces.v1.AgentService.ListTools] call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the tools. Use
  // "include_system_tools=true" to include system tools in the response. See
  // https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListTools][google.cloud.ces.v1.AgentService.ListTools].
message ListToolsResponse {
  // The list of tools.
  repeated Tool tools = 1;

  // A token that can be sent as
  // [ListToolsRequest.page_token][google.cloud.ces.v1.ListToolsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetTool][google.cloud.ces.v1.AgentService.GetTool].
message GetToolRequest {
  // Required. The resource name of the tool to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Tool" }
  ];
}

// Request message for
// [AgentService.CreateTool][google.cloud.ces.v1.AgentService.CreateTool].
message CreateToolRequest {
  // Required. The resource name of the app to create a tool in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { child_type: "ces.googleapis.com/Tool" }
  ];

  // Optional. The ID to use for the tool, which will become the final component
  // of the tool's resource name. If not provided, a unique ID will be
  // automatically assigned for the tool.
  string tool_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateTool][google.cloud.ces.v1.AgentService.UpdateTool].
message UpdateToolRequest {
  // Required. The tool to update.
  Tool tool = 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];
}

// Request message for
// [AgentService.DeleteTool][google.cloud.ces.v1.AgentService.DeleteTool].
message DeleteToolRequest {
  // Required. The resource name of the tool to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Tool" }
  ];

  // Optional. Indicates whether to forcefully delete the tool, even if it is
  // still referenced by agents/examples.
  //
  // *  If `force = false`, the deletion will fail if any agents still
  // reference the tool.
  // *  If `force = true`, all existing references from agents will be removed
  // and the tool will be deleted.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.ListConversations][google.cloud.ces.v1.AgentService.ListConversations].
message ListConversationsRequest {
  // Required. The resource name of the app to list conversations from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Conversation"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListConversationsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListConversations][google.cloud.ces.v1.AgentService.ListConversations]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the conversations.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicate the source of the conversation. If not set, Source.Live
  // will be applied by default. Will be deprecated in favor of `sources` field.
  Conversation.Source source = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicate the sources of the conversations. If not set, all
  // available sources will be applied by default.
  repeated Conversation.Source sources = 6
      [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListConversations][google.cloud.ces.v1.AgentService.ListConversations].
message ListConversationsResponse {
  // The list of conversations.
  repeated Conversation conversations = 1;

  // A token that can be sent as
  // [ListConversationsRequest.page_token][google.cloud.ces.v1.ListConversationsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetConversation][google.cloud.ces.v1.AgentService.GetConversation].
message GetConversationRequest {
  // Required. The resource name of the conversation to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "ces.googleapis.com/Conversation"
    }
  ];

  // Optional. Indicate the source of the conversation. If not set, all source
  // will be searched.
  Conversation.Source source = 2
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [AgentService.DeleteConversation][google.cloud.ces.v1.AgentService.DeleteConversation].
message DeleteConversationRequest {
  // Required. The resource name of the conversation to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "ces.googleapis.com/Conversation"
    }
  ];

  // Optional. Indicate the source of the conversation. If not set, Source.Live
  // will be applied by default.
  Conversation.Source source = 2
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [AgentService.BatchDeleteConversations][google.cloud.ces.v1.AgentService.BatchDeleteConversations].
message BatchDeleteConversationsRequest {
  // Required. The resource name of the app to delete conversations from.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Conversation"
    }
  ];

  // Required. The resource names of the conversations to delete.
  repeated string conversations = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "ces.googleapis.com/Conversation"
    }
  ];
}

// Response message for
// [AgentService.BatchDeleteConversations][google.cloud.ces.v1.AgentService.BatchDeleteConversations].
message BatchDeleteConversationsResponse {
  // The list of conversations that were successfully deleted.
  repeated string deleted_conversations = 1;

  // The list of conversations that failed to be deleted.
  repeated string failed_conversations = 2;

  // Optional. A list of error messages associated with conversations that
  // failed to be deleted.
  repeated string error_messages = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [AgentService.ListGuardrails][google.cloud.ces.v1.AgentService.ListGuardrails].
message ListGuardrailsRequest {
  // Required. The resource name of the app to list guardrails from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Guardrail"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListGuardrailsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListGuardrails][google.cloud.ces.v1.AgentService.ListGuardrails]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the guardrails.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListGuardrails][google.cloud.ces.v1.AgentService.ListGuardrails].
message ListGuardrailsResponse {
  // The list of guardrails.
  repeated Guardrail guardrails = 1;

  // A token that can be sent as
  // [ListGuardrailsRequest.page_token][google.cloud.ces.v1.ListGuardrailsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetGuardrail][google.cloud.ces.v1.AgentService.GetGuardrail].
message GetGuardrailRequest {
  // Required. The resource name of the guardrail to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Guardrail" }
  ];
}

// Request message for
// [AgentService.CreateGuardrail][google.cloud.ces.v1.AgentService.CreateGuardrail].
message CreateGuardrailRequest {
  // Required. The resource name of the app to create a guardrail in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Guardrail"
    }
  ];

  // Optional. The ID to use for the guardrail, which will become the final
  // component of the guardrail's resource name. If not provided, a unique ID
  // will be automatically assigned for the guardrail.
  string guardrail_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateGuardrail][google.cloud.ces.v1.AgentService.UpdateGuardrail].
message UpdateGuardrailRequest {
  // Required. The guardrail to update.
  Guardrail guardrail = 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];
}

// Request message for
// [AgentService.DeleteGuardrail][google.cloud.ces.v1.AgentService.DeleteGuardrail].
message DeleteGuardrailRequest {
  // Required. The resource name of the guardrail to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Guardrail" }
  ];

  // Optional. Indicates whether to forcefully delete the guardrail, even if it
  // is still referenced by app/agents.
  //
  // *  If `force = false`, the deletion fails if any apps/agents still
  // reference the guardrail.
  // *  If `force = true`, all existing references from apps/agents will be
  // removed and the guardrail will be deleted.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.ListDeployments][google.cloud.ces.v1.AgentService.ListDeployments].
message ListDeploymentsRequest {
  // Required. The parent app.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Deployment"
    }
  ];

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

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

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListDeployments][google.cloud.ces.v1.AgentService.ListDeployments].
message ListDeploymentsResponse {
  // The list of deployments.
  repeated Deployment deployments = 1;

  // A token, which can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetDeployment][google.cloud.ces.v1.AgentService.GetDeployment].
message GetDeploymentRequest {
  // Required. The name of the deployment.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}/deployments/{deployment}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Deployment" }
  ];
}

// Request message for
// [AgentService.CreateDeployment][google.cloud.ces.v1.AgentService.CreateDeployment].
message CreateDeploymentRequest {
  // Required. The parent app.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Deployment"
    }
  ];

  // Optional. The ID to use for the deployment, which will become the final
  // component of the deployment's resource name. If not provided, a unique ID
  // will be automatically assigned for the deployment.
  string deployment_id = 3 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateDeployment][google.cloud.ces.v1.AgentService.UpdateDeployment].
message UpdateDeploymentRequest {
  // Required. The deployment to update.
  Deployment deployment = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The list of fields to update.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [AgentService.DeleteDeployment][google.cloud.ces.v1.AgentService.DeleteDeployment].
message DeleteDeploymentRequest {
  // Required. The name of the deployment to delete.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}/deployments/{deployment}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Deployment" }
  ];

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

// Request message for
// [AgentService.ListToolsets][google.cloud.ces.v1.AgentService.ListToolsets].
message ListToolsetsRequest {
  // Required. The resource name of the app to list toolsets from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Toolset"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListToolsetsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListToolsets][google.cloud.ces.v1.AgentService.ListToolsets]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the toolsets.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListToolsets][google.cloud.ces.v1.AgentService.ListToolsets].
message ListToolsetsResponse {
  // The list of toolsets.
  repeated Toolset toolsets = 1;

  // A token that can be sent as
  // [ListToolsetsRequest.page_token][google.cloud.ces.v1.ListToolsetsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetToolset][google.cloud.ces.v1.AgentService.GetToolset].
message GetToolsetRequest {
  // Required. The resource name of the toolset to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Toolset" }
  ];
}

// Request message for
// [AgentService.CreateToolset][google.cloud.ces.v1.AgentService.CreateToolset].
message CreateToolsetRequest {
  // Required. The resource name of the app to create a toolset in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Toolset"
    }
  ];

  // Optional. The ID to use for the toolset, which will become the final
  // component of the toolset's resource name. If not provided, a unique ID will
  // be automatically assigned for the toolset.
  string toolset_id = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.UpdateToolset][google.cloud.ces.v1.AgentService.UpdateToolset].
message UpdateToolsetRequest {
  // Required. The toolset to update.
  Toolset toolset = 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];
}

// Request message for
// [AgentService.DeleteToolset][google.cloud.ces.v1.AgentService.DeleteToolset].
message DeleteToolsetRequest {
  // Required. The resource name of the toolset to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Toolset" }
  ];

  // Optional. Indicates whether to forcefully delete the toolset, even if it is
  // still referenced by app/agents.
  //
  // *  If `force = false`, the deletion fails if any agents still
  // reference the toolset.
  // *  If `force = true`, all existing references from agents will be
  // removed and the toolset will be deleted.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];

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

// Request message for
// [AgentService.ListAppVersions][google.cloud.ces.v1.AgentService.ListAppVersions].
message ListAppVersionsRequest {
  // Required. The resource name of the app to list app versions from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/AppVersion"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListAppVersionsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListAppVersions][google.cloud.ces.v1.AgentService.ListAppVersions]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the app versions.
  // See https://google.aip.dev/160 for more details.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListAppVersions][google.cloud.ces.v1.AgentService.ListAppVersions].
message ListAppVersionsResponse {
  // The list of app versions.
  repeated AppVersion app_versions = 1;

  // A token that can be sent as
  // [ListAppVersionsRequest.page_token][google.cloud.ces.v1.ListAppVersionsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetAppVersion][google.cloud.ces.v1.AgentService.GetAppVersion].
message GetAppVersionRequest {
  // Required. The resource name of the app version to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/AppVersion" }
  ];
}

// Request message for
// [AgentService.DeleteAppVersion][google.cloud.ces.v1.AgentService.DeleteAppVersion].
message DeleteAppVersionRequest {
  // Required. The resource name of the app version to delete.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/AppVersion" }
  ];

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

// Request message for
// [AgentService.CreateAppVersion][google.cloud.ces.v1.AgentService.CreateAppVersion]
message CreateAppVersionRequest {
  // Required. The resource name of the app to create an app version in.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/AppVersion"
    }
  ];

  // Optional. The ID to use for the app version, which will become the final
  // component of the app version's resource name. If not provided, a unique ID
  // will be automatically assigned for the app version.
  string app_version_id = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. The app version to create.
  AppVersion app_version = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request message for
// [AgentService.RestoreAppVersion][google.cloud.ces.v1.AgentService.RestoreAppVersion]
message RestoreAppVersionRequest {
  // Required. The resource name of the app version to restore.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/AppVersion" }
  ];
}

// Response message for
// [AgentService.RestoreAppVersion][google.cloud.ces.v1.AgentService.RestoreAppVersion]
message RestoreAppVersionResponse {}

// Request message for
// [AgentService.ListChangelogs][google.cloud.ces.v1.AgentService.ListChangelogs].
message ListChangelogsRequest {
  // Required. The resource name of the app to list changelogs from.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "ces.googleapis.com/Changelog"
    }
  ];

  // Optional. Requested page size. 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. The
  // [next_page_token][google.cloud.ces.v1.ListChangelogsResponse.next_page_token]
  // value returned from a previous list
  // [AgentService.ListChangelogs][google.cloud.ces.v1.AgentService.ListChangelogs]
  // call.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to be applied when listing the changelogs.
  // See https://google.aip.dev/160 for more details.
  //
  // The filter string can be used to filter by `action`, `resource_type`,
  // `resource_name`, `author`, and `create_time`.
  // The `:` comparator can be used for case-insensitive partial matching on
  // string fields, while `=` performs an exact case-sensitive match.
  //
  // Examples:
  // * `action:update` (case-insensitive partial match)
  // * `action="Create"` (case-sensitive exact match)
  // * `resource_type:agent`
  // * `resource_name:my-agent`
  // * `author:me@example.com`
  // * `create_time > "2025-01-01T00:00:00Z"`
  // * `create_time <= "2025-01-01T00:00:00Z" AND resource_type:tool`
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Field to sort by. Only "name" and "create_time" is supported.
  // See https://google.aip.dev/132#ordering for more details.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [AgentService.ListChangelogs][google.cloud.ces.v1.AgentService.ListChangelogs].
message ListChangelogsResponse {
  // The list of changelogs.
  repeated Changelog changelogs = 1;

  // A token that can be sent as
  // [ListChangelogsRequest.page_token][google.cloud.ces.v1.ListChangelogsRequest.page_token]
  // to retrieve the next page. Absence of this field indicates there are no
  // subsequent pages.
  string next_page_token = 2;
}

// Request message for
// [AgentService.GetChangelog][google.cloud.ces.v1.AgentService.GetChangelog].
message GetChangelogRequest {
  // Required. The resource name of the changelog to retrieve.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "ces.googleapis.com/Changelog" }
  ];
}
