syntax = "proto3";
package logger;

import "google/protobuf/timestamp.proto";

service Logger {
  // Store logs
  rpc StoreLogs(StoreLogsRequest) returns (StoreLogsResponse);

  // Get stored logs
  rpc GetLogs(LogsRequest) returns (LogsResponse);

  // Get fresh logs as they are incoming
  rpc GetLogsStream(LogsRequest) returns (stream LogLine);
}

message StoreLogsRequest {
  repeated LogItem logs = 1;
}

message StoreLogsResponse {
  bool success = 1;
}

message LogsRequest {
  string deployment_id = 1;
}

message LogsResponse {
  repeated LogLine log_items = 1;
}

message LogItem {
  string deployment_id = 1;
  LogLine log_line = 2;
}

message LogLine {
  string service_name = 1;
  google.protobuf.Timestamp tx_timestamp = 2;
  bytes data = 3;
}
