syntax = "proto3";

package com.wix.ecommerce.commons.api;

import "google/protobuf/struct.proto";
import "wix/common/paging.proto";
import "wix/common/sorting.proto";
import "wix/common/query.proto";
import "wix/api/annotations.proto";
import "com/wix/ecommerce/commons/api/platformPaging.proto";

option java_multiple_files = true;
option java_package = "com.wix.ecommerce.commons.api";

message PlatformSearch {
  option (.wix.api.decomposite_of) = "wix.common.Search";
  option (.wix.api.decomposition_minimum_fields) = {
    field: "filter"
    field: "sort"
    field: "paging"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "filter"
    field: "sort"
    field: "cursorPaging"
  };
  // A filter object. Learn more about [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language).
  google.protobuf.Struct filter = 1;
  //Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]
  repeated .wix.common.Sorting sort = 2;
   //Aggregations | Faceted search: refers to a way to explore large amounts of data by displaying summaries about various partitions of the data and later allowing to narrow the navigation to a specific partition.
  repeated .wix.common.Aggregation aggregations = 5;
  //free text to match in searchable fields
  .wix.common.SearchDetails search = 6;
  oneof paging_method {
    //Pointer to page of results using offset. Can not be used together with 'cursor_paging'
    PlatformPaging paging = 7 [(.wix.api.field_exposure) = PRIVATE];
    //Cursor pointing to page of results. Can't be used together with 'paging'. 'cursor_paging.cursor' can not be used together with 'filter' or 'sort'
    .wix.common.CursorPaging cursor_paging = 8;
  }
}

message PlatformOffsetSearch {
  option (.wix.api.decomposite_of) = "wix.common.Search";
  option (.wix.api.decomposition_minimum_fields) = {
    field: "filter"
    field: "sort"
    field: "paging"
  };
  // A filter object. Learn more about [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language).
  google.protobuf.Struct filter = 1;
  //Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]
  repeated .wix.common.Sorting sort = 2;
  //Aggregations | Faceted search: refers to a way to explore large amounts of data by displaying summaries about various partitions of the data and later allowing to narrow the navigation to a specific partition.
  repeated .wix.common.Aggregation aggregations = 5;
  //free text to match in searchable fields
  .wix.common.SearchDetails search = 6;
  oneof paging_method {
    //Pointer to page of results using offset. Can not be used together with 'cursor_paging'
    PlatformPaging paging = 7;
  }
}