// 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/protobuf/timestamp.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 = "BackupvaultCloudSqlProto";
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: "sqladmin.googleapis.com/Instance"
  pattern: "projects/{project}/instances/{instance}"
};

// CloudSqlInstanceDataSourceProperties represents the properties of a
// Cloud SQL resource that are stored in the DataSource.
message CloudSqlInstanceDataSourceProperties {
  // Output only. Name of the Cloud SQL instance backed up by the datasource.
  // Format:
  // projects/{project}/instances/{instance}
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "sqladmin.googleapis.com/Instance"
    }
  ];

  // Output only. The installed database version of the Cloud SQL instance.
  string database_installed_version = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The instance creation timestamp.
  google.protobuf.Timestamp instance_create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The tier (or machine type) for this instance. Example:
  // `db-custom-1-3840`
  string instance_tier = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// CloudSqlInstanceBackupProperties represents Cloud SQL Instance
// Backup properties.
message CloudSqlInstanceBackupProperties {
  // Output only. The installed database version of the Cloud SQL instance
  // when the backup was taken.
  string database_installed_version = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Whether the backup is a final backup.
  bool final_backup = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The source instance of the backup.
  // Format:
  // projects/{project}/instances/{instance}
  string source_instance = 4 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "sqladmin.googleapis.com/Instance"
    }
  ];

  // Output only. The instance creation timestamp.
  google.protobuf.Timestamp instance_create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The tier (or machine type) for this instance. Example:
  // `db-custom-1-3840`
  string instance_tier = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The instance delete timestamp.
  google.protobuf.Timestamp instance_delete_time = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// CloudSqlInstanceDataSourceReferenceProperties represents the properties of a
// Cloud SQL resource that are stored in the DataSourceReference.
message CloudSqlInstanceDataSourceReferenceProperties {
  // Output only. Name of the Cloud SQL instance backed up by the datasource.
  // Format:
  // projects/{project}/instances/{instance}
  string name = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "sqladmin.googleapis.com/Instance"
    }
  ];

  // Output only. The installed database version of the Cloud SQL instance.
  string database_installed_version = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The instance creation timestamp.
  google.protobuf.Timestamp instance_create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The tier (or machine type) for this instance. Example:
  // `db-custom-1-3840`
  string instance_tier = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// CloudSqlInstanceInitializationConfig contains the configuration for
// initializing a Cloud SQL instance.
message CloudSqlInstanceInitializationConfig {
  // The edition of the Cloud SQL instance. For details, see
  // https://cloud.google.com/sql/docs/editions-intro.
  enum Edition {
    // Unspecified edition.
    EDITION_UNSPECIFIED = 0;

    // Enterprise edition.
    ENTERPRISE = 1;

    // Enterprise Plus edition.
    ENTERPRISE_PLUS = 2;
  }

  // Required. The edition of the Cloud SQL instance.
  Edition edition = 1 [(google.api.field_behavior) = REQUIRED];
}

// Cloud SQL instance's BPA properties.
message CloudSqlInstanceBackupPlanAssociationProperties {
  // Output only. The time when the instance was created.
  google.protobuf.Timestamp instance_create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}
