// 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.gkebackup.v1;

import "google/api/field_behavior.proto";
import "google/api/field_info.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.GkeBackup.V1";
option go_package = "cloud.google.com/go/gkebackup/apiv1/gkebackuppb;gkebackuppb";
option java_multiple_files = true;
option java_outer_classname = "RestoreChannelProto";
option java_package = "com.google.cloud.gkebackup.v1";
option php_namespace = "Google\\Cloud\\GkeBackup\\V1";
option ruby_package = "Google::Cloud::GkeBackup::V1";

// A RestoreChannel imposes constraints on where backups can be restored.
// The RestoreChannel should be in the same project and region
// as the backups. The backups can only be restored in the
// `destination_project`.
message RestoreChannel {
  option (google.api.resource) = {
    type: "gkebackup.googleapis.com/RestoreChannel"
    pattern: "projects/{project}/locations/{location}/restoreChannels/{restore_channel}"
    plural: "restoreChannels"
    singular: "restoreChannel"
  };

  // Identifier. The fully qualified name of the RestoreChannel.
  // `projects/*/locations/*/restoreChannels/*`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. Immutable. The project into which the backups will be restored.
  // The format is `projects/{projectId}` or `projects/{projectNumber}`.
  string destination_project = 2 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.field_behavior) = REQUIRED
  ];

  // Output only. Server generated global unique identifier of
  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
  string uid = 3 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OUTPUT_ONLY
  ];

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

  // Output only. The timestamp when this RestoreChannel was last updated.
  google.protobuf.Timestamp update_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. A set of custom labels supplied by user.
  map<string, string> labels = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. User specified descriptive string for this RestoreChannel.
  string description = 7 [(google.api.field_behavior) = OPTIONAL];

  // Output only. `etag` is used for optimistic concurrency control as a way to
  // help prevent simultaneous updates of a RestoreChannel from overwriting each
  // other. It is strongly suggested that systems make use of the 'etag' in the
  // read-modify-write cycle to perform RestoreChannel updates in order to
  // avoid race conditions: An `etag` is returned in the response to
  // `GetRestoreChannel`, and systems are expected to put that etag in the
  // request to `UpdateRestoreChannel` or `DeleteRestoreChannel` to
  // ensure that their change will be applied to the same version of the
  // resource.
  string etag = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The project_id where backups will be restored.
  // Example Project ID: "my-project-id".
  // This will be an OUTPUT_ONLY field to return the project_id of the
  // destination project.
  string destination_project_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
}
