import { DocumentData } from './document.public-types';
import { Alias, JoinCondition, Query } from './query.public-types';
/**
 * Represents a simple serialized query structure for database operations.
 * @category Database
 */
export type SerializedSimpleQuery = {
    /** Specifies that this is a simple query type. */
    type: 'simple';
    /** The query object defining the database operation. */
    query: Query;
    /** Indicates whether references should be dereferenced during query execution. */
    dereference: boolean;
};
/**
 * Represents a serialized join query structure for database operations with multiple table relationships.
 * @category Database
 */
export type SerializedJoinQuery = {
    /** Specifies that this is a join query type. */
    type: 'join';
    /** Specifies if the results should be grouped by the root alias. */
    grouped: boolean;
    /** Indicates whether references should be dereferenced during query execution. */
    dereference: boolean;
    /** The root table configuration for the join operation. */
    root: RootTableDetails;
    /** A mapping of aliases to their dependent aliases, defining the join order from left to right. */
    leftToRight: Record<Alias, Alias[]>;
    /** A mapping of aliases to their corresponding queries for joined tables. */
    joins: Record<Alias, Query<DocumentData>>;
    /** A mapping of aliases to their join conditions. */
    joinConditions: Record<Alias, JoinCondition>;
};
/**
 * Configuration details for the root table used in a join query.
 * The root table serves as the entry point for evaluating joined data across multiple tables.
 * @category Database
 */
export interface RootTableDetails {
    /** The alias for the root table in the join operation. */
    alias: Alias;
    /** The query object defining the root table's operation. */
    query: Query;
}
/**
 * Represents a serialized merged query structure combining multiple queries for database operations.
 * @category Database
 */
export type SerializedMergedQuery = {
    /** Specifies that this is a merged query type. */
    type: 'merged';
    /** An array of serialized queries to be merged. */
    queries: Array<SerializedQuery>;
};
/**
 * A union type representing all possible serialized query structures for database operations.
 * @category Database
 */
export type SerializedQuery = SerializedSimpleQuery | SerializedJoinQuery | SerializedMergedQuery;
