// 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.ai.generativelanguage.v1beta2;

import "google/ai/generativelanguage/v1beta2/model.proto";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option go_package = "cloud.google.com/go/ai/generativelanguage/apiv1beta2/generativelanguagepb;generativelanguagepb";
option java_multiple_files = true;
option java_outer_classname = "ModelServiceProto";
option java_package = "com.google.ai.generativelanguage.v1beta2";

// Provides methods for getting metadata information about Generative Models.
service ModelService {
  option (google.api.default_host) = "generativelanguage.googleapis.com";

  // Gets information about a specific Model.
  rpc GetModel(GetModelRequest) returns (Model) {
    option (google.api.http) = {
      get: "/v1beta2/{name=models/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists models available through the API.
  rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
    option (google.api.http) = {
      get: "/v1beta2/models"
    };
    option (google.api.method_signature) = "page_size,page_token";
  }
}

// Request for getting information about a specific Model.
message GetModelRequest {
  // Required. The resource name of the model.
  //
  // This name should match a model name returned by the `ListModels` method.
  //
  // Format: `models/{model}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "generativelanguage.googleapis.com/Model"
    }
  ];
}

// Request for listing all Models.
message ListModelsRequest {
  // The maximum number of `Models` to return (per page).
  //
  // The service may return fewer models.
  // If unspecified, at most 50 models will be returned per page.
  // This method returns at most 1000 models per page, even if you pass a larger
  // page_size.
  int32 page_size = 2;

  // A page token, received from a previous `ListModels` call.
  //
  // Provide the `page_token` returned by one request as an argument to the next
  // request to retrieve the next page.
  //
  // When paginating, all other parameters provided to `ListModels` must match
  // the call that provided the page token.
  string page_token = 3;
}

// Response from `ListModel` containing a paginated list of Models.
message ListModelsResponse {
  // The returned Models.
  repeated Model models = 1;

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