import "org/infinispan/protostream/message-wrapping.proto";

package org.infinispan.query.remote.client;

message QueryRequest {

   /**
    * The query string, expressed in JPA query language.
    * NOTE: currently only a limited subset of the JPA query language is supported.
    */
   required string jpqlString = 1;

   // id 2 was used for sort criteria

   /**
    * The number of matching results to skip before the first returned result.
    */
   required int64 startOffset = 3;

   /**
    * Maximum number of matching results to return.
    */
   required int32 maxResults = 4;
}

message QueryResponse {

   /**
    * The number of returned results.
    */
   required int32 numResults = 1;

  /**
   * Indicates presence and size of projections.
   *
   *      0 - no projection
   * 1 .. N - projection with N components
   *    < 0 - illegal value
   */
   required int32 projectionSize = 2;

   /**
    * The list of matching results. The size should be either numResults, if no projections are used, or numResults *
    * projectionSize otherwise. If projections are used, then each group of projectionSize consecutive elements
    * represent together a result.
    */
   repeated org.infinispan.protostream.WrappedMessage results = 3;

   required int64 totalResults = 4;
}
