/**
 * @fileoverview Generic function to aggregate entities with metrics and grouping.
 * @description Provides a reusable implementation for computing aggregations on Firestore collections.
 * Returns only computed metrics, never raw data - optimized for analytics dashboards.
 *
 * @version 0.1.0
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
import * as v from 'valibot';
/** Supported aggregation operations */
export type AggregateOperation = 'count' | 'sum' | 'avg' | 'min' | 'max';
/** Single metric definition */
export interface MetricDefinition {
    /** Field to aggregate ('*' for count all) */
    field: string;
    /** Aggregation operation */
    operation: AggregateOperation;
    /** Output name for this metric */
    as: string;
    /** Optional filter for this metric */
    filter?: {
        field: string;
        operator: '==' | '!=' | '>' | '<' | '>=' | '<=';
        value: any;
    };
}
/** Group by definition */
export interface GroupByDefinition {
    /** Field to group by */
    field: string;
    /** Metrics to compute per group */
    metrics: MetricDefinition[];
}
/** Aggregation configuration */
export interface AggregateConfig {
    /** Top-level metrics (computed on entire collection) */
    metrics?: MetricDefinition[];
    /** Group by configurations */
    groupBy?: GroupByDefinition[];
    /** Optional global filters */
    where?: Array<[string, any, any]>;
}
/**
 * Generic function to aggregate entities from any Firestore collection.
 * Returns only computed metrics, never raw data.
 *
 * @param collection - The Firestore collection name
 * @param documentSchema - The Valibot schema (used for visibility checks)
 * @param config - Aggregation configuration (metrics, groupBy, filters)
 * @returns Firebase callable function
 *
 * @example
 * ```typescript
 * // Define analytics for cars collection
 * export const getCarsAnalytics = aggregateEntities('cars', carSchema, {
 *   metrics: [
 *     { field: '*', operation: 'count', as: 'total' },
 *     { field: 'price', operation: 'sum', as: 'totalValue' },
 *     { field: 'price', operation: 'avg', as: 'avgPrice' },
 *   ],
 *   groupBy: [
 *     {
 *       field: 'status',
 *       metrics: [
 *         { field: '*', operation: 'count', as: 'count' },
 *         { field: 'price', operation: 'sum', as: 'value' },
 *       ],
 *     },
 *   ],
 * });
 *
 * // Returns:
 * // {
 * //   metrics: { total: 150, totalValue: 4500000, avgPrice: 30000 },
 * //   groups: {
 * //     status: {
 * //       Available: { count: 80, value: 2400000 },
 * //       Reserved: { count: 20, value: 600000 },
 * //       Sold: { count: 50, value: 1500000 },
 * //     }
 * //   },
 * //   meta: { collection: 'cars', totalDocs: 150, computedAt: '...' }
 * // }
 * ```
 *
 * @version 0.1.0
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
export declare const aggregateEntities: (collection: string, documentSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, config: AggregateConfig) => import("firebase-functions/https").CallableFunction<{
    where?: [string, any, any][] | undefined;
    dateRange?: {
        field: string;
        start?: string | undefined;
        end?: string | undefined;
    } | undefined;
}, any, unknown>;
