syntax = "proto3";

package protocols.grpc.common;

import "google/protobuf/struct.proto";

message ErrorDetail {
  int32 code = 1;         // 錯誤碼，0=成功
  string message = 2;      // 人類可讀訊息
  string detail = 3;       // 技術細節 (可選)
}

message CommonRequest {
  google.protobuf.Struct data = 1;
}

message CommonResponse {
  google.protobuf.Struct data = 1;
  protocols.grpc.common.ErrorDetail error = 2;
}

message ServiceInfoRequest {}

message ModelInfo {
  string model_id = 1;
  string version = 2;
  repeated string supported_languages = 3;
  bool support_streaming = 4;
  string description = 5;
}

message ServiceInfoResponse {
  string service_name = 1;
  string version = 2;
  repeated ModelInfo models = 3;
  protocols.grpc.common.ErrorDetail error = 4;
}

service CommonService{
  rpc GetServiceInfo(ServiceInfoRequest) returns (ServiceInfoResponse);
  rpc Unary (CommonRequest) returns (CommonResponse) {}
  rpc OutputStreaming (CommonRequest) returns (stream CommonResponse) {}
  rpc InputStreaming (stream CommonRequest) returns (CommonResponse) {}
  rpc BidiStreaming (stream CommonRequest) returns (stream CommonResponse) {}
}