// Copyright 2022-2025 The Connect Authors
//
// 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 observability.ping.v1;

message PingRequest {
  int64 id = 1;
  bytes data = 2;
}

message PingResponse {
  int64 id = 1;
  bytes data = 2;
}

message FailRequest {
  int32 code = 1;
}

message FailResponse {}

message PingStreamRequest {
  int64 id = 1;
  bytes data = 2;
}

message PingStreamResponse {
  int64 id = 1;
  bytes data = 2;
}

service PingService {
  // Ping sends a ping to the server to determine if it's reachable.
  rpc Ping(PingRequest) returns (PingResponse) {
    option idempotency_level = NO_SIDE_EFFECTS;
  }
  // PingStream sends a ful-duplex stream of pings to the server.
  rpc PingStream(stream PingStreamRequest) returns (stream PingStreamResponse) {}
  // Fail sends a request to the server that will generate an error.
  rpc Fail(FailRequest) returns (FailResponse) {}
}
