import type { CatalogProperty, Search } from 'udp-stencil-component-library'; // ── Intent (what the model emits via the propose tool) ── // // The model never produces a raw Search object. It produces this declarative // intermediate representation; compile.ts turns it into Search/columns state // deterministically (group ids, operator strings, value joining all happen // in code, not in the model). export type AiOperator = 'equals' | 'not_equals' | 'contains' | 'starts_with' | 'greater_than' | 'greater_than_or_equal' | 'less_than' | 'less_than_or_equal' | 'between' | 'in' | 'not_in' | 'is_empty' | 'is_not_empty'; export interface AiCondition { field: string; operator: AiOperator; /** Single-value operators (equals, contains, greater_than, ...) */ value?: string; /** Multi-value operators: between (exactly 2), in / not_in (1..500) */ values?: string[]; } export interface AiConditionGroup { op: 'and' | 'or'; conditions: AiCondition[]; } /** * Full replacement of the filter state: direct root conditions plus at most * one level of subgroups — mirroring the advanced search builder's max depth. */ export interface AiFilterSpec { op: 'and' | 'or'; conditions: AiCondition[]; groups?: AiConditionGroup[]; } export interface AiSortSpec { field: string; direction: 'ASC' | 'DESC'; } export type AiAggregateOperation = 'COUNT' | 'SUM' | 'MIN' | 'MAX' | 'AVG'; export interface AiGroupingSpec { groupBy: string[]; aggregates: { field: string; operation: AiAggregateOperation; }[]; } /** Column visibility changes. showOnly wins over show/hide when present. */ export interface AiColumnSpec { showOnly?: string[]; show?: string[]; hide?: string[]; } /** * Sections set to null (or omitted) are left unchanged; a present-but-empty * section clears that part of the query. Declarative full-state per section. */ export interface QueryIntent { explanation: string; filters?: AiFilterSpec | null; sorts?: AiSortSpec[] | null; grouping?: AiGroupingSpec | null; columns?: AiColumnSpec | null; pageSize?: number | null; } // ── Schema context (what the model is told about the queryable surface) ── // // This is the normalized contract every host adapts its own schema source to: // Data Builder derives it from the product catalog, a grid host from its // column definitions or catalogModification. Hosts with richer context // (relationships, entity lists) extend this shape with their own fields. export interface AiFilterField { /** Dot path as the search API expects it, e.g. "startDate" or "AssignmentPosition.positionName" */ path: string; /** Normalized type: guid | string | number | boolean | date | datetime | time */ type: string; } export interface AiColumnInfo { name: string; type: string; orderable: boolean; aggregatable: boolean; visible: boolean; } export interface AiSearchSchemaContext { /** Capitalized simple entity name, e.g. "Assignment" */ entityName: string; filterFields: AiFilterField[]; columns: AiColumnInfo[]; } // ── Compiled output ── export interface CompiledSearchChanges { searchBody: Search; columns: CatalogProperty[]; } // ── Proposal diff presented to the user ── export interface AiDiffLine { kind: 'filters' | 'sorts' | 'grouping' | 'columns' | 'pageSize'; text: string; } //# sourceMappingURL=types.d.ts.map