// Copyright 2025 The gRPC 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";

///////////////////////////////////////////////////////////////////////////////
// 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
//
// This protocol is under active development, and will change in backwards
// incompatible ways in the future.
//
// DO NOT take a dependency on this without contacting the gRPC authors
// (who will advise against taking such a dependency in as strong a fashion
// as they are able)
//
// 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
///////////////////////////////////////////////////////////////////////////////

package grpc.channelz.v2;

import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";

// Key/value store for generic channelz properties
message PropertyList {
  message Element {
    string key = 1;
    PropertyValue value = 2;
  }
  repeated Element properties = 1;
}

// Two-dimensional grid of channelz properties.
// It's expected that each row will have the same number of value
// entries as there are columns.
// If there are more values in a row than columns, then the extra values
// are ignored and a warning should be reported.
// If there are fewer values in a row than columns, then the missing values
// are filled with empty values.
message PropertyGrid {
  message Row {
    string label = 1;
    repeated PropertyValue value = 2;
  }
  repeated string columns = 1;
  repeated Row rows = 2;
}

// A list of channelz properties.
// It's expected that each row will have the same number of value
// entries as there are columns.
// If there are more values in a row than columns, then the extra values
// are ignored and a warning should be reported.
// If there are fewer values in a row than columns, then the missing values
// are filled with empty values.
message PropertyTable {
  message Row {
    repeated PropertyValue value = 1;
  }
  repeated string columns = 1;
  repeated Row rows = 2;
}

// One value: for simple/common types we inline them in here.
// For anything more complicated we use a google.protobuf.Any.
// Since channelz is used for debugging low level things, we
// include both int64 and uint64 for full fidelity of whatever value
// is being reported.
message PropertyValue {
  oneof kind {
    google.protobuf.Empty empty_value = 1;
    google.protobuf.Any any_value = 2;
    string string_value = 3;
    int64 int64_value = 4;
    uint64 uint64_value = 5;
    double double_value = 6;
    bool bool_value = 7;
    google.protobuf.Timestamp timestamp_value = 8;
    google.protobuf.Duration duration_value = 9;
  }
}
