// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Expression } from "./Expression";
import type { Ordered } from "./Ordered";

/**
 * Represent a named aggregate function call with optional FILTER, ORDER BY, and LIMIT.
 *
 * This struct is used for aggregate function calls that are not covered by
 * one of the dedicated typed variants (e.g. `Count`, `Sum`). It supports
 * SQL:2003 FILTER (WHERE ...) clauses, ordered-set aggregates, and
 * IGNORE NULLS / RESPECT NULLS modifiers.
 */
export type AggregateFunction = { 
/**
 * The aggregate function name (e.g. "JSON_AGG", "XMLAGG").
 */
name: string, 
/**
 * Positional arguments.
 */
args: Array<Expression>, 
/**
 * Whether DISTINCT was specified.
 */
distinct: boolean, 
/**
 * Optional FILTER (WHERE ...) clause applied to the aggregate.
 */
filter: Expression | null, 
/**
 * ORDER BY inside aggregate (e.g., JSON_AGG(x ORDER BY y))
 */
order_by?: Array<Ordered>, 
/**
 * LIMIT inside aggregate (e.g., ARRAY_CONCAT_AGG(x LIMIT 2))
 */
limit?: Expression | null, 
/**
 * IGNORE NULLS / RESPECT NULLS
 */
ignore_nulls?: boolean | null, };
