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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/backupdr/v1/backupvault_gce.proto";

option csharp_namespace = "Google.Cloud.BackupDR.V1";
option go_package = "cloud.google.com/go/backupdr/apiv1/backupdrpb;backupdrpb";
option java_multiple_files = true;
option java_outer_classname = "BackupvaultDiskProto";
option java_package = "com.google.cloud.backupdr.v1";
option php_namespace = "Google\\Cloud\\BackupDR\\V1";
option ruby_package = "Google::Cloud::BackupDR::V1";
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/StoragePool"
  pattern: "projects/{project}/zones/{zone}/storagePools/{storage_pool}"
};

// LINT: LEGACY_NAMES

// DiskTargetEnvironment represents the target environment for the disk.
message DiskTargetEnvironment {
  // Required. Target project for the disk.
  string project = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Target zone for the disk.
  string zone = 2 [(google.api.field_behavior) = REQUIRED];
}

// RegionDiskTargetEnvironment represents the target environment for the disk.
message RegionDiskTargetEnvironment {
  // Required. Target project for the disk.
  string project = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Target region for the disk.
  string region = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Target URLs of the replica zones for the disk.
  repeated string replica_zones = 3 [(google.api.field_behavior) = REQUIRED];
}

// DiskRestoreProperties represents the properties of a Disk restore.
message DiskRestoreProperties {
  // The supported access modes of the disk.
  enum AccessMode {
    // The default AccessMode, means the disk can be attached to single instance
    // in RW mode.
    READ_WRITE_SINGLE = 0;

    // The AccessMode means the disk can be attached to multiple instances in RW
    // mode.
    READ_WRITE_MANY = 1;

    // The AccessMode means the disk can be attached to multiple instances in RO
    // mode.
    READ_ONLY_MANY = 2;
  }

  // Architecture of the source disk.
  enum Architecture {
    // Default value. This value is unused.
    ARCHITECTURE_UNSPECIFIED = 0;

    // Disks with architecture X86_64
    X86_64 = 1;

    // Disks with architecture ARM64
    ARM64 = 2;
  }

  // Required. Name of the disk.
  optional string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional description of this resource. Provide this property
  // when you create the resource.
  optional string description = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. The size of the disk in GB.
  optional int64 size_gb = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. A list of publicly available licenses that are applicable to this
  // backup. This is applicable if the original image had licenses attached,
  // e.g. Windows image
  repeated string licenses = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A list of features to enable in the guest operating system. This
  // is applicable only for bootable images.
  repeated GuestOsFeature guest_os_feature = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Encrypts the disk using a
  // customer-supplied encryption key or a customer-managed encryption key.
  optional CustomerEncryptionKey disk_encryption_key = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Physical block size of the persistent disk, in bytes.
  // If not present in a request, a default value is used.
  // Currently, the supported size is 4096.
  optional int64 physical_block_size_bytes = 7
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicates how many IOPS to provision for the disk. This sets the
  // number of I/O operations per second that the disk can handle.
  optional int64 provisioned_iops = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicates how much throughput to provision for the disk. This
  // sets the number of throughput MB per second that the disk can handle.
  optional int64 provisioned_throughput = 9
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicates whether this disk is using confidential compute mode.
  // Encryption with a Cloud KMS key is required to enable this option.
  optional bool enable_confidential_compute = 10
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The storage pool in which the new disk is created. You can
  // provide this as a partial or full URL to the resource.
  optional string storage_pool = 11 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/StoragePool"
    }
  ];

  // Optional. The access mode of the disk.
  optional AccessMode access_mode = 12 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The architecture of the source disk. Valid values are
  // ARM64 or X86_64.
  optional Architecture architecture = 14
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Resource policies applied to this disk.
  repeated string resource_policy = 15 [(google.api.field_behavior) = OPTIONAL];

  // Required. URL of the disk type resource describing which disk type to use
  // to create the disk.
  optional string type = 16 [(google.api.field_behavior) = REQUIRED];

  // Optional. Labels to apply to this disk. These can be modified later using
  // <code>setLabels</code> method. Label values can be empty.
  map<string, string> labels = 17 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Resource manager tags to be bound to the disk.
  map<string, string> resource_manager_tags = 18
      [(google.api.field_behavior) = OPTIONAL];
}

// DiskBackupProperties represents the properties of a Disk backup.
message DiskBackupProperties {
  // Architecture of the source disk.
  enum Architecture {
    // Default value. This value is unused.
    ARCHITECTURE_UNSPECIFIED = 0;

    // Disks with architecture X86_64
    X86_64 = 1;

    // Disks with architecture ARM64
    ARM64 = 2;
  }

  // A description of the source disk.
  optional string description = 1;

  // A list of publicly available licenses that are applicable to this backup.
  // This is applicable if the original image had licenses attached, e.g.
  // Windows image.
  repeated string licenses = 2;

  // A list of guest OS features that are applicable to this backup.
  repeated GuestOsFeature guest_os_feature = 3;

  // The architecture of the source disk. Valid values are
  // ARM64 or X86_64.
  optional Architecture architecture = 4;

  // The URL of the type of the disk.
  optional string type = 5;

  // Size(in GB) of the source disk.
  optional int64 size_gb = 6;

  // Region and zone are mutually exclusive fields.
  // The URL of the region of the source disk.
  optional string region = 7;

  // The URL of the Zone where the source disk.
  optional string zone = 8;

  // The URL of the Zones where the source disk should be replicated.
  repeated string replica_zones = 9;

  // The source disk used to create this backup.
  optional string source_disk = 10;
}

// DiskDataSourceProperties represents the properties of a
// Disk resource that are stored in the DataSource.
// .
message DiskDataSourceProperties {
  // Name of the disk backed up by the datasource.
  string name = 1;

  // The description of the disk.
  string description = 2;

  // The type of the disk.
  string type = 3;

  // The size of the disk in GB.
  int64 size_gb = 4;
}
