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

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

option csharp_namespace = "Google.Cloud.NetApp.V1";
option go_package = "cloud.google.com/go/netapp/apiv1/netapppb;netapppb";
option java_multiple_files = true;
option java_outer_classname = "BackupVaultProto";
option java_package = "com.google.cloud.netapp.v1";
option php_namespace = "Google\\Cloud\\NetApp\\V1";
option ruby_package = "Google::Cloud::NetApp::V1";

// A NetApp BackupVault.
message BackupVault {
  option (google.api.resource) = {
    type: "netapp.googleapis.com/BackupVault"
    pattern: "projects/{project}/locations/{location}/backupVaults/{backup_vault}"
    plural: "backupVaults"
    singular: "backupVault"
  };

  // Retention policy for backups in the backup vault
  message BackupRetentionPolicy {
    // Required. Minimum retention duration in days for backups in the backup
    // vault.
    int32 backup_minimum_enforced_retention_days = 1
        [(google.api.field_behavior) = REQUIRED];

    // Optional. Indicates if the daily backups are immutable.
    // Atleast one of daily_backup_immutable, weekly_backup_immutable,
    // monthly_backup_immutable and manual_backup_immutable must be true.
    bool daily_backup_immutable = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Indicates if the weekly backups are immutable.
    // Atleast one of daily_backup_immutable, weekly_backup_immutable,
    // monthly_backup_immutable and manual_backup_immutable must be true.
    bool weekly_backup_immutable = 3 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Indicates if the monthly backups are immutable.
    // Atleast one of daily_backup_immutable, weekly_backup_immutable,
    // monthly_backup_immutable and manual_backup_immutable must be true.
    bool monthly_backup_immutable = 4 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Indicates if the manual backups are immutable.
    // Atleast one of daily_backup_immutable, weekly_backup_immutable,
    // monthly_backup_immutable and manual_backup_immutable must be true.
    bool manual_backup_immutable = 5 [(google.api.field_behavior) = OPTIONAL];
  }

  // The Backup Vault States
  enum State {
    // State not set.
    STATE_UNSPECIFIED = 0;

    // BackupVault is being created.
    CREATING = 1;

    // BackupVault is available for use.
    READY = 2;

    // BackupVault is being deleted.
    DELETING = 3;

    // BackupVault is not valid and cannot be used.
    ERROR = 4;

    // BackupVault is being updated.
    UPDATING = 5;
  }

  // Backup Vault Type.
  enum BackupVaultType {
    // BackupVault type not set.
    BACKUP_VAULT_TYPE_UNSPECIFIED = 0;

    // BackupVault type is IN_REGION.
    IN_REGION = 1;

    // BackupVault type is CROSS_REGION.
    CROSS_REGION = 2;
  }

  // Identifier. The resource name of the backup vault.
  // Format:
  // `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. The backup vault state.
  State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Create time of the backup vault.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Description of the backup vault.
  string description = 4;

  // Resource labels to represent user provided metadata.
  map<string, string> labels = 5;

  // Optional. Type of backup vault to be created.
  // Default is IN_REGION.
  BackupVaultType backup_vault_type = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Output only. Region in which the backup vault is created.
  // Format: `projects/{project_id}/locations/{location}`
  string source_region = 7 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. Region where the backups are stored.
  // Format: `projects/{project_id}/locations/{location}`
  string backup_region = 8 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Output only. Name of the Backup vault created in source region.
  // Format:
  // `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`
  string source_backup_vault = 9 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/BackupVault"
    }
  ];

  // Output only. Name of the Backup vault created in backup region.
  // Format:
  // `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`
  string destination_backup_vault = 10 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/BackupVault"
    }
  ];

  // Optional. Backup retention policy defining the retenton of backups.
  BackupRetentionPolicy backup_retention_policy = 11
      [(google.api.field_behavior) = OPTIONAL];
}

// GetBackupVaultRequest gets the state of a backupVault.
message GetBackupVaultRequest {
  // Required. The backupVault resource name, in the format
  // `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/BackupVault"
    }
  ];
}

// ListBackupVaultsRequest lists backupVaults.
message ListBackupVaultsRequest {
  // Required. The location for which to retrieve backupVault information,
  // in the format
  // `projects/{project_id}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "netapp.googleapis.com/BackupVault"
    }
  ];

  // The maximum number of items to return.
  int32 page_size = 2;

  // The next_page_token value to use if there are additional
  // results to retrieve for this list request.
  string page_token = 3;

  // Sort results. Supported values are "name", "name desc" or "" (unsorted).
  string order_by = 4;

  // List filter.
  string filter = 5;
}

// ListBackupVaultsResponse is the result of ListBackupVaultsRequest.
message ListBackupVaultsResponse {
  // A list of backupVaults in the project for the specified location.
  repeated BackupVault backup_vaults = 1;

  // The token you can use to retrieve the next page of results. Not returned
  // if there are no more results in the list.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// CreateBackupVaultRequest creates a backup vault.
message CreateBackupVaultRequest {
  // Required. The location to create the backup vaults, in the format
  // `projects/{project_id}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "netapp.googleapis.com/BackupVault"
    }
  ];

  // Required. The ID to use for the backupVault.
  // The ID must be unique within the specified location.
  // Must contain only letters, numbers and hyphen, with the first
  // character a letter, the last a letter or a
  // number, and a 63 character maximum.
  string backup_vault_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. A backupVault resource
  BackupVault backup_vault = 3 [(google.api.field_behavior) = REQUIRED];
}

// DeleteBackupVaultRequest deletes a backupVault.
message DeleteBackupVaultRequest {
  // Required. The backupVault resource name, in the format
  // `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/BackupVault"
    }
  ];
}

// UpdateBackupVaultRequest updates description and/or labels for a backupVault.
message UpdateBackupVaultRequest {
  // Required. Field mask is used to specify the fields to be overwritten in the
  // Backup resource to be updated.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The backupVault being updated
  BackupVault backup_vault = 2 [(google.api.field_behavior) = REQUIRED];
}
