syntax = "proto3";

import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";
import "wix/common/paging.proto";
import "wix/common/sorting.proto";
import "wix/api/annotations.proto";
import "wix/api/validations.proto";

package wix.fedinfra.exportservicespi.v1;

message ExportQueryV2 {
  option (.wix.api.decomposition_minimum_fields) = {
    field: "filter"
    field: "sort"
    field: "paging"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "filter"
    field: "sort"
    field: "cursorPaging"
  };
  //Filter object in the following format:
  //`"filter" : {
  //              "fieldName1": "value1",
  //              "fieldName2":{"$operator":"value2"}
  //  }`
  //Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
  google.protobuf.Struct filter = 1;
  //Sort object in the following format:
  //`[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
  repeated .wix.common.Sorting sort = 2;
  //Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned.
  repeated string fields = 4;
  //Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned.
  repeated string fieldsets = 5;
  oneof pagingMethod {
    //Paging options to limit and skip the number of items.
    .wix.common.Paging paging = 3;
    //Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.
    ExportCursorPaging cursorPaging = 6;
  }
}

message ExportCursorPaging {
  option (.wix.api.decomposition_minimum_fields) = {
    field: "limit"
    field: "cursor"
  };

  google.protobuf.Int32Value limit = 1 [(.wix.api.min) = 0, (.wix.api.max) = 10000];
  google.protobuf.StringValue cursor = 2;
}
