/** @module @airtable/blocks/models: RecordQueryResult */ /** */
import Sdk from "../sdk";
import { FlowAnyObject, FlowAnyExistential, FlowAnyFunction } from "../private_utils";
import { VisList, NormalizedGroupLevel } from "../types/airtable_interface";
import { GroupLevelData, GroupData } from "../types/view";
import Table from "./table";
import View from "./view";
import RecordQueryResult, { WatchableRecordQueryResultKey, NormalizedRecordQueryResultOpts, NormalizedSortConfig } from "./record_query_result";
import Field from "./field";
import Record from "./record";
import ObjectPool from "./object_pool";
import RecordStore from "./record_store";
import ViewDataStore from "./view_data_store";
import GroupedRecordQueryResult from "./grouped_record_query_result";
import { GroupLevels } from "./view_metadata_query_result";
/** @hidden */
interface TableOrViewQueryResultData {
    recordIds: Array<string> | null;
    groups: Array<GroupedRecordQueryResult> | null;
    groupLevels: Array<NormalizedGroupLevel> | null;
}
/**
 * Represents a set of records directly from a view or table. See {@link RecordQueryResult} for main
 * documentation.
 *
 * Do not instantiate. You can get instances of this class by calling
 * `table.selectRecords` or `view.selectRecords`.
 *
 * @docsPath models/query results/TableOrViewQueryResult
 */
declare class TableOrViewQueryResult extends RecordQueryResult<TableOrViewQueryResultData> {
    /** @internal */
    static _className: string;
    /** @internal */
    _sourceModel: Table | View;
    /** @internal */
    _mostRecentSourceModelLoadPromise: Promise<FlowAnyExistential> | null;
    /** @internal */
    _table: Table;
    /** @internal */
    _fieldIdsSetToLoadOrNullIfAllFields: {
        [key: string]: true;
    } | null;
    /** @internal */
    _visList: VisList | null;
    /** @internal */
    _sorts: Array<NormalizedSortConfig> | null;
    /** @internal */
    _groupLevels: Array<NormalizedGroupLevel> | null;
    /** @internal */
    _orderedRecordIds: Array<string> | null;
    /** @internal */
    _orderedGroups: Array<GroupedRecordQueryResult> | null;
    /** @internal */
    _loadedGroupLevels: Array<NormalizedGroupLevel> | null;
    /** @internal */
    _recordIdsSet: {
        [key: string]: true | void;
    } | null;
    /** @internal */
    _cellValueKeyWatchCounts: {
        [key: string]: number;
    };
    /** @internal */
    __groupedRecordQueryResultPool: ObjectPool<GroupedRecordQueryResult, typeof GroupedRecordQueryResult>;
    /** @internal */
    constructor(sdk: Sdk, sourceModel: Table | View, normalizedOpts: NormalizedRecordQueryResultOpts);
    /** @internal */
    get _dataOrNullIfDeleted(): TableOrViewQueryResultData | null;
    /** @internal */
    get __sourceModelId(): string;
    /** @internal */
    get __poolKey(): string;
    /**
     * @internal (since we may not be able to return parent model instances in the immutable models world)
     * The table that records in this RecordQueryResult are part of
     */
    get parentTable(): Table;
    /**
     * @internal (since we may not be able to return parent model instances in the immutable models world)
     * The view that was used to obtain this RecordQueryResult by calling
     * `view.selectRecords`. Null if the RecordQueryResult was obtained by calling
     * `table.selectRecords`.
     */
    get parentView(): View | null;
    /**
     * The record IDs in this RecordQueryResult.
     * Throws if data is not loaded yet.
     * Can be watched.
     */
    get recordIds(): Array<string>;
    /**
     * The ordered GroupedRecordQueryResult's in this RecordQueryResult.
     * Throws if data is not loaded yet.
     * Can be watched.
     *
     * @hidden
     */
    get groups(): Array<GroupedRecordQueryResult> | null;
    /**
     * The GroupLevels in this RecordQueryResult.
     * Throws if data is not loaded yet.
     * Can be watched.
     *
     * @hidden
     */
    get groupLevels(): GroupLevels | null;
    /**
     * The set of record IDs in this RecordQueryResult.
     * Throws if data is not loaded yet.
     *
     * @internal
     */
    _getOrGenerateRecordIdsSet(): {
        [key: string]: true | void;
    };
    /**
     * The fields that were used to create this RecordQueryResult.
     * Null if fields were not specified, which means the RecordQueryResult
     * will load all fields in the table.
     */
    get fields(): Array<Field> | null;
    /** @internal */
    get _cellValuesForSortWatchKeys(): Array<string>;
    /** @internal */
    get _cellValuesForGroupWatchKeys(): Array<string>;
    /** @internal */
    get _sourceModelRecordIds(): Array<string>;
    /** @internal */
    get _sourceModelGroups(): Array<GroupData> | null;
    /** @internal */
    get _sourceModelGroupLevels(): Array<GroupLevelData> | null;
    /** @internal */
    get _sourceModelRecords(): Array<Record>;
    /** @internal */
    _incrementCellValueKeyWatchCountAndWatchIfNecessary(key: string, watchCallback: FlowAnyFunction): void;
    /** @internal */
    _decrementCellValueKeyWatchCountAndUnwatchIfPossible(key: string, watchCallback: FlowAnyFunction): void;
    /** @inheritdoc */
    watch(keys: WatchableRecordQueryResultKey | ReadonlyArray<WatchableRecordQueryResultKey>, callback: FlowAnyFunction, context?: FlowAnyObject | null): Array<WatchableRecordQueryResultKey>;
    /** @inheritdoc */
    unwatch(keys: WatchableRecordQueryResultKey | ReadonlyArray<WatchableRecordQueryResultKey>, callback: FlowAnyFunction, context?: FlowAnyObject | null): Array<WatchableRecordQueryResultKey>;
    /** @inheritdoc */
    loadDataAsync(): Promise<void>;
    /**
     * @internal
     */
    _getChangedKeysOnLoad(): Array<WatchableRecordQueryResultKey>;
    /** @internal */
    _loadDataAsync(): Promise<Array<WatchableRecordQueryResultKey>>;
    /** @inheritdoc */
    unloadData(): void;
    /** @internal */
    _unloadData(): void;
    /** @internal */
    _addRecordIdsToVisList(recordIds: Array<string>): void;
    /** @internal */
    _onGroupLevelsChanged(model: RecordStore | ViewDataStore, key: string, updates?: {
        addedRecordIds: Array<string>;
        removedRecordIds: Array<string>;
    } | null): void;
    /** @internal */
    _onGroupsChanged(model: RecordStore | ViewDataStore, key: string, updates?: {
        addedRecordIds: Array<string>;
        removedRecordIds: Array<string>;
    } | null): void;
    /** @internal */
    _onRecordsChanged(model: RecordStore | ViewDataStore, key: string, updates?: {
        addedRecordIds: Array<string>;
        removedRecordIds: Array<string>;
    } | null): void;
    /** @internal */
    _onCellValuesForGroupChanged(recordStore: RecordStore, key: string, recordIds?: Array<string> | null, fieldId?: string | null): void;
    /** @internal */
    _onCellValuesForSortChanged(recordStore: RecordStore, key: string, recordIds?: Array<string> | null, fieldId?: string | null): void;
    /** @internal */
    _onFieldConfigChanged(_field: Field, _key: string): void;
    /** @internal */
    _onTableFieldsChanged(table: Table, key: string, updates: {
        addedFieldIds: Array<string>;
        removedFieldIds: Array<string>;
    }): void;
    /** @internal */
    _onCellValuesChanged(table: Table, key: string, updates?: FlowAnyObject | null): void;
    /** @internal */
    _onCellValuesInFieldChanged(table: Table, key: string, recordIds?: Array<string> | null, fieldId?: string | null): void;
    /** @internal */
    _generateOrderedRecordIds(): Array<string>;
    /** @internal */
    _generateAndLoadOrderedGroups(): Array<GroupedRecordQueryResult> | null;
    /** @internal */
    _unloadOrderedGroupsIfNeeded(): void;
    /**
     * If groupings change then some groups will need to be created, and some removed
     * This (TODO: will) handle the diffing necessary to unload, and reload only the changed groups.
     * Also triggers the WatchableKeys.group, as by necessity this will have changed.
     *
     * @internal
     */
    _unloadRemovedGroupsAndLoadNewGroupsAndTriggerWatches(): void;
    /** @internal */
    _replaceVisList(): void;
    /** @internal */
    _getSortsWithDeletedFieldsFiltered(): Array<NormalizedSortConfig>;
    /** @internal */
    _spawnErrorForDeletion(): Error;
}
export default TableOrViewQueryResult;
