syntax = "proto3";

package types.v1;

import "google/protobuf/struct.proto";

option go_package = "types/v1;typesv1";

message FormatConfig {
  message Color {
    string html_hex_color = 1;
  }
  message Style {
    Color foreground = 1;
    optional Color background = 2;
    // ANSI text formatting
    optional bool bold = 300;
    optional bool italic = 301;
    optional bool faint = 302;
    optional bool blink = 303;
    optional bool strikethrough = 304;
    optional bool underline = 305;
  }
  message NullStyle {
    Style style = 1;
    string content = 2;
  }
  message LevelStyle {
    Style debug = 100;
    Style info = 200;
    Style warn = 300;
    Style error = 400;
    Style panic = 500;
    Style fatal = 600;
    Style unknown = 700;
  }
  message Theme {
    Style key = 1;
    Style value = 2;
    Style time = 3;
    Style msg = 4;
    LevelStyle levels = 5;
    // how to style messages that are missing
    Style absent_msg = 6;
    Style absent_time = 7;
  }

  message Themes {
    Theme light = 1;
    Theme dark = 2;
  }

  message Truncation {
    int64 length = 1;
  }
  message Time {
    optional string format = 1;
    optional string timezone = 2;
    optional string absent_default_value = 3;
  }
  message Message {
    optional string absent_default_value = 1;
  }
  enum ColorMode {
    COLORMODE_AUTO = 0;
    COLORMODE_ENABLED = 1;
    COLORMODE_DISABLED = 2;
  }

  Themes themes = 1;
  repeated string skip_fields = 2;
  repeated string keep_fields = 3;
  optional bool sort_longest = 4;
  optional bool skip_unchanged = 5;
  optional Truncation truncation = 6;
  optional Time time = 7;
  optional Message message = 8;
  optional ColorMode terminal_color_mode = 9;
}

message ParseConfig {
  message Time {
    repeated string field_names = 1;
  }
  message Message {
    repeated string field_names = 1;
  }
  message Level {
    repeated string field_names = 1;
  }
  Time timestamp = 1;
  Message message = 2;
  Level level = 3;
}

message ServeLocalhostConfig {
  int64 port = 1;
  string engine = 2;
  google.protobuf.Struct engine_config = 3;
  optional bool show_in_systray = 4;
  optional string log_dir = 5;
}

message RuntimeConfig {
  message Features {}
  message ExperimentalFeatures {
    optional string release_channel = 1;
    optional bool send_logs_to_cloud = 2;
    optional ServeLocalhostConfig serve_localhost = 3;
  }
  message ClientConfig {
    enum HTTPProtocol {
      HTTP2 = 0;
      HTTP1 = 1;
    }
    enum RPCProtocol {
      GRPC = 0;
      GRPC_WEB = 1;
      PROTOJSON = 2;
    }
    optional HTTPProtocol http_protocol = 1;
    optional RPCProtocol rpc_protocol = 2;
  }
  optional bool interrupt = 1;
  optional bool skip_check_for_updates = 2;
  Features features = 3;
  ExperimentalFeatures experimental_features = 4;
  ClientConfig api_client = 5;
}

message LocalhostConfig {
  int64 version = 1;

  FormatConfig formatter = 2;
  ParseConfig parser = 3;
  RuntimeConfig runtime = 4;
}
