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

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/apihub/v1/common_fields.proto";

option csharp_namespace = "Google.Cloud.ApiHub.V1";
option go_package = "cloud.google.com/go/apihub/apiv1/apihubpb;apihubpb";
option java_multiple_files = true;
option java_outer_classname = "DiscoveryServiceProto";
option java_package = "com.google.cloud.apihub.v1";
option php_namespace = "Google\\Cloud\\ApiHub\\V1";
option ruby_package = "Google::Cloud::ApiHub::V1";

// This service exposes methods used to manage DiscoveredApiObservations
// and DiscoveredApiOperations.
service ApiHubDiscovery {
  option (google.api.default_host) = "apihub.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists all the DiscoveredAPIObservations in a given project and location.
  rpc ListDiscoveredApiObservations(ListDiscoveredApiObservationsRequest)
      returns (ListDiscoveredApiObservationsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/discoveredApiObservations"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a DiscoveredAPIObservation in a given project, location and
  // ApiObservation.
  rpc GetDiscoveredApiObservation(GetDiscoveredApiObservationRequest)
      returns (DiscoveredApiObservation) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/discoveredApiObservations/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists all the DiscoveredAPIOperations in a given project, location and
  // ApiObservation.
  rpc ListDiscoveredApiOperations(ListDiscoveredApiOperationsRequest)
      returns (ListDiscoveredApiOperationsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/discoveredApiObservations/*}/discoveredApiOperations"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a DiscoveredAPIOperation in a given project, location,
  // ApiObservation and ApiOperation.
  rpc GetDiscoveredApiOperation(GetDiscoveredApiOperationRequest)
      returns (DiscoveredApiOperation) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/discoveredApiObservations/*/discoveredApiOperations/*}"
    };
    option (google.api.method_signature) = "name";
  }
}

// Message for requesting list of DiscoveredApiObservations
message ListDiscoveredApiObservationsRequest {
  // Required. The parent, which owns this collection of ApiObservations.
  // Format:
  // projects/{project}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "apihub.googleapis.com/DiscoveredApiObservation"
    }
  ];

  // Optional. The maximum number of ApiObservations to return. The service may
  // return fewer than this value. If unspecified, at most 10
  // ApiObservations 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 page token, received from a previous `ListApiObservations`
  // call. Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to
  // `ListApiObservations` must match the call that provided the page
  // token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Message for response to listing DiscoveredApiObservations
message ListDiscoveredApiObservationsResponse {
  // The DiscoveredApiObservation from the specified project and location.
  repeated DiscoveredApiObservation discovered_api_observations = 1;

  // A token, which can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Message for requesting list of DiscoveredApiOperations
message ListDiscoveredApiOperationsRequest {
  // Required. The parent, which owns this collection of
  // DiscoveredApiOperations. Format:
  // projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "apihub.googleapis.com/DiscoveredApiOperation"
    }
  ];

  // Optional. DiscoveredApiOperations 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 page token, received from a previous
  // `ListDiscoveredApiApiOperations` call. Provide this to retrieve the
  // subsequent page.
  //
  // When paginating, all other parameters provided to
  // `ListDiscoveredApiApiOperations` must match the call that provided the page
  // token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Message for response to listing DiscoveredApiOperations
message ListDiscoveredApiOperationsResponse {
  // The DiscoveredApiOperations from the specified project, location
  // and DiscoveredApiObservation.
  repeated DiscoveredApiOperation discovered_api_operations = 1;

  // A token, which can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Message for requesting a DiscoveredApiObservation
message GetDiscoveredApiObservationRequest {
  // Required. The name of the DiscoveredApiObservation to retrieve.
  // Format:
  // projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "apihub.googleapis.com/DiscoveredApiObservation"
    }
  ];
}

// Message for requesting a DiscoveredApiOperation
message GetDiscoveredApiOperationRequest {
  // Required. The name of the DiscoveredApiOperation to retrieve.
  // Format:
  // projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}/discoveredApiOperations/{discovered_api_operation}
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "apihub.googleapis.com/DiscoveredApiOperation"
    }
  ];
}
