// Copyright 2021 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
//
//     https://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";

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";

package google.bookshop.v1beta1;

option go_package = "github.com/googleapis/gapic-showcase/server/genproto";
option java_package = "com.google.bookshop.v1beta1";
option java_outer_classname = "BookshopProto";
option java_multiple_files = true;

// Exercises name conflict behavior in Java.
service Bookshop {
  // This service is meant to only run locally on the port 7469 (keypad digits
  // for "book").
  option (google.api.default_host) = "localhost:2665";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // This method simply echos the request. This method is showcases unary rpcs.
  rpc GetBook(GetBookRequest) returns (Book) {
    option (google.api.http) = {
      post: "/v1beta1/echo:echo"
      body: "*"
    };
    option (google.api.method_signature) = "books_count,books";
    option (google.api.method_signature) = "books_list,books";
  }
}

message GetBookRequest {
  // The number of books.
  int32 books_count = 1;

  // The name of the book list.
  string books_list = 2;

  // The books.
  repeated Book books = 3;
}

message Book {
  // The bookk title.
  string title = 1;
}
