// Copyright 2023 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.aiplatform.v1beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/aiplatform/v1beta1/publisher_model.proto";

option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
option java_multiple_files = true;
option java_outer_classname = "ModelGardenServiceProto";
option java_package = "com.google.cloud.aiplatform.v1beta1";
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";

// The interface of Model Garden Service.
service ModelGardenService {
  option (google.api.default_host) = "aiplatform.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Gets a Model Garden publisher model.
  rpc GetPublisherModel(GetPublisherModelRequest) returns (PublisherModel) {
    option (google.api.http) = {
      get: "/v1beta1/{name=publishers/*/models/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists publisher models in Model Garden.
  rpc ListPublisherModels(ListPublisherModelsRequest)
      returns (ListPublisherModelsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=publishers/*}/models"
    };
    option (google.api.method_signature) = "parent";
  }
}

// View enumeration of PublisherModel.
enum PublisherModelView {
  // The default / unset value. The API will default to the BASIC view.
  PUBLISHER_MODEL_VIEW_UNSPECIFIED = 0;

  // Include basic metadata about the publisher model, but not the full
  // contents.
  PUBLISHER_MODEL_VIEW_BASIC = 1;

  // Include everything.
  PUBLISHER_MODEL_VIEW_FULL = 2;

  // Include: VersionId, ModelVersionExternalName, and SupportedActions.
  PUBLISHER_MODEL_VERSION_VIEW_BASIC = 3;
}

// Request message for
// [ModelGardenService.GetPublisherModel][google.cloud.aiplatform.v1beta1.ModelGardenService.GetPublisherModel]
message GetPublisherModelRequest {
  // Required. The name of the PublisherModel resource.
  // Format:
  // `publishers/{publisher}/models/{publisher_model}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "aiplatform.googleapis.com/PublisherModel"
    }
  ];

  // Optional. The IETF BCP-47 language code representing the language in which
  // the publisher model's text information should be written in (see go/bcp47).
  string language_code = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. PublisherModel view specifying which fields to read.
  PublisherModelView view = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [ModelGardenService.ListPublisherModels][google.cloud.aiplatform.v1beta1.ModelGardenService.ListPublisherModels].
message ListPublisherModelsRequest {
  // Required. The name of the Publisher from which to list the PublisherModels.
  // Format: `publishers/{publisher}`
  string parent = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The standard list filter.
  string filter = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The standard list page size.
  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The standard list page token.
  // Typically obtained via
  // [ListPublisherModelsResponse.next_page_token][google.cloud.aiplatform.v1beta1.ListPublisherModelsResponse.next_page_token]
  // of the previous
  // [ModelGardenService.ListPublisherModels][google.cloud.aiplatform.v1beta1.ModelGardenService.ListPublisherModels]
  // call.
  string page_token = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. PublisherModel view specifying which fields to read.
  PublisherModelView view = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A comma-separated list of fields to order by, sorted in ascending
  // order. Use "desc" after a field name for descending.
  string order_by = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The IETF BCP-47 language code representing the language in which
  // the publisher models' text information should be written in (see go/bcp47).
  // If not set, by default English (en).
  string language_code = 7 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [ModelGardenService.ListPublisherModels][google.cloud.aiplatform.v1beta1.ModelGardenService.ListPublisherModels].
message ListPublisherModelsResponse {
  // List of PublisherModels in the requested page.
  repeated PublisherModel publisher_models = 1;

  // A token to retrieve next page of results.
  // Pass to [ListPublisherModels.page_token][] to obtain that page.
  string next_page_token = 2;
}
