// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v1.174.0
//   protoc               v3.12.4
// source: Search.proto

/* eslint-disable */
import { type ValueSetsDto, type VariableDto } from './Magma';
import { type EntryDto } from './Opal';

export const protobufPackage = 'Search';

export enum TermOperator {
  AND_OP = 'AND_OP',
  OR_OP = 'OR_OP',
  UNRECOGNIZED = 'UNRECOGNIZED',
}

export interface QueryTermsDto {
  queries: QueryTermDto[];
}

export interface QueryTermDto {
  global?: boolean | undefined;
  /** name of the facet, if not provided no facet is returned for this term */
  facet?: string | undefined;
}

export interface VariableTermDto {
  variable: string;
  /** when not specified: make the aggregation according to the variable nature */
  type?: VariableTermDto_AggType | undefined;
}

export enum VariableTermDto_AggType {
  MISSING = 'MISSING',
  CARDINALITY = 'CARDINALITY',
  TERMS = 'TERMS',
  STATS = 'STATS',
  PERCENTILES = 'PERCENTILES',
  UNRECOGNIZED = 'UNRECOGNIZED',
}

export interface FilterDto {
  variable: string;
  not?: boolean | undefined;
}

export interface LogicalTermDto {
  operator: TermOperator;
}

export interface InTermDto {
  values: string[];
  minimumMatch?: number | undefined;
}

/** do we need specialized ranges depending on the value type ? */
export interface RangeTermDto {
  from?: string | undefined;
  to?: string | undefined;
  includeLower?: boolean | undefined;
  includeUpper?: boolean | undefined;
}

export interface QueryResultDto {
  facets: FacetResultDto[];
  totalHits: number;
  hits: ItemResultDto[];
}

export interface FacetResultDto {
  facet: string;
  frequencies: FacetResultDto_TermFrequencyResultDto[];
  statistics?: FacetResultDto_StatisticalResultDto | undefined;
  filters: FacetResultDto_FilterResultDto[];
  values: FacetResultDto_ValueResultDto[];
}

export interface FacetResultDto_FilterResultDto {
  count: number;
}

export interface FacetResultDto_TermFrequencyResultDto {
  term: string;
  count: number;
}

export interface FacetResultDto_ValueResultDto {
  key?: string | undefined;
  count?: number | undefined;
  value?: number | undefined;
}

export interface FacetResultDto_StatisticalResultDto {
  count: number;
  /** total is the sum */
  total?: number | undefined;
  min?: number | undefined;
  max?: number | undefined;
  mean?: number | undefined;
  sumOfSquares?: number | undefined;
  variance?: number | undefined;
  stdDeviation?: number | undefined;
}

export interface ItemResultDto {
  identifier: string;
}

export interface ItemFieldsDto {
  /** key is the field name, value is the field value for the item */
  fields: EntryDto[];
}

export interface VariableItemDto {
  variable: VariableDto | undefined;
}

export interface ValueSetsResultDto {
  totalHits: number;
  valueSets?: ValueSetsDto | undefined;
}

export interface EntitiesResultDto {
  entityType: string;
  totalHits: number;
  query: string;
  hits: ItemResultDto[];
  partialResults: EntitiesResultDto[];
}
