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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/ces/v1beta/common.proto";
import "google/protobuf/timestamp.proto";

option go_package = "cloud.google.com/go/ces/apiv1beta/cespb;cespb";
option java_multiple_files = true;
option java_outer_classname = "ChannelProfileProto";
option java_package = "com.google.cloud.ces.v1beta";

// A deployment represents an immutable, queryable version of the app.
// It is used to deploy an app version with a specific channel profile.
message Deployment {
  option (google.api.resource) = {
    type: "ces.googleapis.com/Deployment"
    pattern: "projects/{project}/locations/{location}/apps/{app}/deployments/{deployment}"
    plural: "deployments"
    singular: "deployment"
  };

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

  // Required. Display name of the deployment.
  string display_name = 8 [(google.api.field_behavior) = REQUIRED];

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

  // Required. The channel profile used in the deployment.
  ChannelProfile channel_profile = 3 [(google.api.field_behavior) = REQUIRED];

  // Output only. Timestamp when this deployment was created.
  google.protobuf.Timestamp create_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp when this deployment was last updated.
  google.protobuf.Timestamp update_time = 5
      [(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];
}
