// 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/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/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/protobuf/timestamp.proto";

option go_package = "cloud.google.com/go/ces/apiv1/cespb;cespb";
option java_multiple_files = true;
option java_outer_classname = "AppVersionProto";
option java_package = "com.google.cloud.ces.v1";

// A snapshot of the app.
message AppSnapshot {
  // Optional. The basic settings for the app.
  App app = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of agents in the app.
  repeated Agent agents = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of tools in the app.
  repeated Tool tools = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of examples in the app.
  repeated Example examples = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of guardrails in the app.
  repeated Guardrail guardrails = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of toolsets in the app.
  repeated Toolset toolsets = 6 [(google.api.field_behavior) = OPTIONAL];
}

// In Customer Engagement Suite (CES), an app version is a snapshot of the app
// at a specific point in time. It is immutable and cannot be modified once
// created.
message AppVersion {
  option (google.api.resource) = {
    type: "ces.googleapis.com/AppVersion"
    pattern: "projects/{project}/locations/{location}/apps/{app}/versions/{version}"
    plural: "appVersions"
    singular: "appVersion"
  };

  // Identifier. The unique identifier of the app version.
  // Format:
  // `projects/{project}/locations/{location}/apps/{app}/versions/{version}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. The display name of the app version.
  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The description of the app version.
  string description = 3 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Email of the user who created the app version.
  string creator = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp when the app version was created.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The snapshot of the app when the version is created.
  AppSnapshot snapshot = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Etag used to ensure the object hasn't changed during a
  // read-modify-write operation. If the etag is empty, the update will
  // overwrite any concurrent changes.
  string etag = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}
