// 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/field_info.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.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 = "OdbNetworkProto";
option java_package = "com.google.cloud.oracledatabase.v1";
option php_namespace = "Google\\Cloud\\OracleDatabase\\V1";
option ruby_package = "Google::Cloud::OracleDatabase::V1";

// Represents OdbNetwork resource.
message OdbNetwork {
  option (google.api.resource) = {
    type: "oracledatabase.googleapis.com/OdbNetwork"
    pattern: "projects/{project}/locations/{location}/odbNetworks/{odb_network}"
    plural: "odbNetworks"
    singular: "odbNetwork"
  };

  // The various lifecycle states of the ODB Network.
  enum State {
    // Default unspecified value.
    STATE_UNSPECIFIED = 0;

    // Indicates that the resource is in provisioning state.
    PROVISIONING = 1;

    // Indicates that the resource is in available state.
    AVAILABLE = 2;

    // Indicates that the resource is in terminating state.
    TERMINATING = 3;

    // Indicates that the resource is in failed state.
    FAILED = 4;
  }

  // Identifier. The name of the OdbNetwork resource in the following format:
  // projects/{project}/locations/{region}/odbNetworks/{odb_network}
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. The name of the VPC network in the following format:
  // projects/{project}/global/networks/{network}
  string network = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];

  // Optional. Labels or tags associated with the resource.
  map<string, string> labels = 3 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The date and time that the OdbNetwork was created.
  google.protobuf.Timestamp create_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of the ODB Network.
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The ID of the subscription entitlement associated with the
  // OdbNetwork.
  string entitlement_id = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The GCP Oracle zone where OdbNetwork is hosted.
  // Example: us-east4-b-r2.
  // If not specified, the system will pick a zone based on availability.
  string gcp_oracle_zone = 7 [(google.api.field_behavior) = OPTIONAL];
}

// The request for `OdbNetwork.Create`.
message CreateOdbNetworkRequest {
  // Required. The parent value for the OdbNetwork in the following format:
  // projects/{project}/locations/{location}.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "oracledatabase.googleapis.com/OdbNetwork"
    }
  ];

  // Required. The ID of the OdbNetwork to create. This value is restricted
  // to (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$) and must be a maximum of 63
  // characters in length. The value must start with a letter and end with
  // a letter or a number.
  string odb_network_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Details of the OdbNetwork instance to create.
  OdbNetwork odb_network = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional ID to identify the request. This value is used to
  // identify duplicate requests. If you make a request with the same request ID
  // and the original request is still in progress or completed, the server
  // ignores the second request. This prevents clients from
  // accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 4 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// The request for `OdbNetwork.Delete`.
message DeleteOdbNetworkRequest {
  // Required. The name of the resource in the following format:
  // projects/{project}/locations/{location}/odbNetworks/{odb_network}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "oracledatabase.googleapis.com/OdbNetwork"
    }
  ];

  // Optional. An optional ID to identify the request. This value is used to
  // identify duplicate requests. If you make a request with the same request ID
  // and the original request is still in progress or completed, the server
  // ignores the second request. This prevents clients from
  // accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 2 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// The request for `OdbNetwork.List`.
message ListOdbNetworksRequest {
  // Required. The parent value for the ODB Network in the following format:
  // projects/{project}/locations/{location}.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "oracledatabase.googleapis.com/OdbNetwork"
    }
  ];

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

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. An expression for filtering the results of the request.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. An expression for ordering the results of the request.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// The response for `OdbNetwork.List`.
message ListOdbNetworksResponse {
  // The list of ODB Networks.
  repeated OdbNetwork odb_networks = 1;

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

  // Unreachable locations when listing resources across all locations using
  // wildcard location '-'.
  repeated string unreachable = 3;
}

// The request for `OdbNetwork.Get`.
message GetOdbNetworkRequest {
  // Required. The name of the OdbNetwork in the following format:
  // projects/{project}/locations/{location}/odbNetworks/{odb_network}.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "oracledatabase.googleapis.com/OdbNetwork"
    }
  ];
}
