syntax = "proto3";
package influxdata.platform.storage;
option go_package = ".;datatypes";

message Node {
  enum Type {
    TypeLogicalExpression = 0;
    TypeComparisonExpression = 1;
    TypeParenExpression = 2;
    TypeTagRef = 3;
    TypeLiteral = 4;
    TypeFieldRef = 5;
  }

  enum Comparison {
    ComparisonEqual = 0;
    ComparisonNotEqual = 1;
    ComparisonStartsWith = 2;
    ComparisonRegex = 3;
    ComparisonNotRegex = 4;
    ComparisonLess = 5;
    ComparisonLessEqual = 6;
    ComparisonGreater = 7;
    ComparisonGreaterEqual = 8;
  }

  // Logical operators apply to boolean values and combine to produce a single boolean result.
  enum Logical {
    LogicalAnd = 0;
    LogicalOr = 1;
  }


  Type node_type = 1; // [(gogoproto.customname) = "NodeType", (gogoproto.jsontag) = "nodeType"];
  repeated Node children = 2;

  oneof value {
    string StringValue = 3;
    bool BooleanValue = 4;
    int64 IntegerValue = 5;
    uint64 UnsignedValue = 6;
    double FloatValue = 7;
    string RegexValue = 8;
    string TagRefValue = 9;
    string FieldRefValue = 10;
    Logical logical = 11;
    Comparison comparison = 12;
  }
}

message Predicate {
  Node root = 1;
}
