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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option csharp_namespace = "Google.Cloud.OracleDatabase.V1";
option go_package = "cloud.google.com/go/oracledatabase/apiv1/oracledatabasepb;oracledatabasepb";
option java_multiple_files = true;
option java_outer_classname = "DbVersionProto";
option java_package = "com.google.cloud.oracledatabase.v1";
option php_namespace = "Google\\Cloud\\OracleDatabase\\V1";
option ruby_package = "Google::Cloud::OracleDatabase::V1";

// A valid Oracle Database version.
message DbVersion {
  option (google.api.resource) = {
    type: "oracledatabase.googleapis.com/DbVersion"
    pattern: "projects/{project}/locations/{location}/dbVersions/{db_version}"
    plural: "dbVersions"
    singular: "dbVersion"
  };

  // Output only. The name of the DbVersion resource in the following format:
  // projects/{project}/locations/{region}/dbVersions/{db_version}
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The properties of the DbVersion.
  DbVersionProperties properties = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The properties of a DbVersion.
message DbVersionProperties {
  // Output only. A valid Oracle Database version.
  string version = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. True if this version of the Oracle Database software is the
  // latest version for a release.
  bool is_latest_for_major_version = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. True if this version of the Oracle Database software supports
  // pluggable databases.
  bool supports_pdb = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. True if this version of the Oracle Database software is the
  // preview version.
  bool is_preview_db_version = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. True if this version of the Oracle Database software is
  // supported for Upgrade.
  bool is_upgrade_supported = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The request for `DbVersions.List`.
message ListDbVersionsRequest {
  // Required. The parent value for the DbVersion resource with the
  // format: projects/{project}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "oracledatabase.googleapis.com/DbVersion"
    }
  ];

  // Optional. The maximum number of items to return.
  // If unspecified, a maximum of 50 DbVersions will be returned.
  // The maximum value is 1000; values above 1000 will be reset to 1000.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying the requested page of results to return. All
  // fields except the filter should remain the same as in the request that
  // provided this page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter expression that matches a subset of the DbVersions to
  // show. The supported filter for dbSystem creation is `db_system_shape =
  // {db_system_shape} AND storage_management = {storage_management}`. If no
  // filter is provided, all DbVersions will be returned.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
}

// The response for `DbVersions.List`.
message ListDbVersionsResponse {
  // The list of DbVersions.
  repeated DbVersion db_versions = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}
