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

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.BackupDR.V1Beta";
option go_package = "cloud.google.com/go/backupdr/apiv1beta/backupdrpb;backupdrpb";
option java_multiple_files = true;
option java_outer_classname = "BackupvaultAlloyDBProto";
option java_package = "com.google.cloud.backupdr.v1beta";
option php_namespace = "Google\\Cloud\\BackupDR\\V1beta";
option ruby_package = "Google::Cloud::BackupDR::V1beta";
option (google.api.resource_definition) = {
  type: "alloydb.googleapis.com/Cluster"
  pattern: "projects/{project}/locations/{location}/clusters/{cluster}"
  plural: "clusters"
  singular: "cluster"
};

// AlloyDBClusterDataSourceProperties represents the properties of a
// AlloyDB cluster resource that are stored in the DataSource.
// .
message AlloyDBClusterDataSourceProperties {
  // Output only. Name of the AlloyDB cluster backed up by the datasource.
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "alloydb.googleapis.com/Cluster" }
  ];

  // Output only. Point in time recovery windows.
  // The order is guaranteed to be ascending by start time.
  repeated AlloyDbPitrWindow pitr_windows = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The cluster UID of the AlloyDB cluster backed up by the
  // datasource.
  string cluster_uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// AlloyDBClusterDataSourceReferenceProperties represents the properties of an
// AlloyDB cluster that are stored in the DataSourceReference.
message AlloyDBClusterDataSourceReferenceProperties {
  // Output only. Name of the AlloyDB cluster backed up by the datasource.
  // Format:
  // projects/{project}/locations/{location}/clusters/{cluster}
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "alloydb.googleapis.com/Cluster" }
  ];
}

// Point in time recovery window for an AlloyDB cluster.
message AlloyDbPitrWindow {
  // Output only. The start time of the PITR window.
  google.protobuf.Timestamp start_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The end time of the PITR window. It is not set if the
  // corresponding Backup Plan Association is active.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Log retention days for the PITR window.
  int64 log_retention_days = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// AlloyDbClusterBackupProperties represents AlloyDB cluster
// backup properties.
// .
message AlloyDbClusterBackupProperties {
  // An optional text description for the backup.
  optional string description = 1;

  // Output only. Storage usage of this particular backup
  int64 stored_bytes = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The chain id of this backup. Backups belonging to the same
  // chain are sharing the same chain id. This property is calculated and
  // maintained by BackupDR.
  string chain_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The PostgreSQL major version of the AlloyDB cluster when the
  // backup was taken.
  string database_version = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Properties for an AlloyDB cluster backup plan association.
message AlloyDBClusterBackupPlanAssociationProperties {
  // Output only. The cluster UID of the AlloyDB cluster.
  string cluster_uid = 1 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OUTPUT_ONLY
  ];
}
