/**
 * Copyright 2023-present DreamNum Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type { ICellData, IColumnData, IObjectArrayPrimitiveType, IObjectMatrixPrimitiveType, IRange, IRowData, IUnitRange, Nullable, ObjectMatrix, Styles, UniverInstanceType } from '@univerjs/core';
import type { sequenceNodeType } from '../engine/utils/sequence';
import type { IImageFormulaInfo } from '../engine/value-object/primitive-object';
export declare const ERROR_VALUE_OBJECT_CLASS_TYPE = "errorValueObject";
export declare const ASYNC_OBJECT_CLASS_TYPE = "asyncObject";
export declare const REFERENCE_OBJECT_CLASS_TYPE = "referenceObject";
export declare const VALUE_OBJECT_CLASS_TYPE = "valueObject";
export declare enum BooleanValue {
    FALSE = "FALSE",
    TRUE = "TRUE"
}
export declare enum AstNodePromiseType {
    SUCCESS = 0,
    ERROR = 1
}
export interface ISheetItem {
    cellData: ObjectMatrix<ICellData>;
    rowCount: number;
    columnCount: number;
    rowData: IObjectArrayPrimitiveType<Partial<IRowData>>;
    columnData: IObjectArrayPrimitiveType<Partial<IColumnData>>;
    defaultColumnWidth?: number;
    defaultRowHeight?: number;
}
export interface ISheetData {
    [sheetId: string]: ISheetItem;
}
/**
 * The subset of workbook data needs to be assembled into a new reference object when being passed in,
 * and then input through the FormulaCurrentConfigService.
 */
export interface IUnitData {
    [unitId: string]: ISheetData;
}
/**
 * Style data, numfmt needs to be queried from the style sheet
 */
export interface IUnitStylesData {
    [unitId: string]: Styles;
}
export interface IRuntimeUnitDataType {
    [unitId: string]: Nullable<{
        [sheetId: string]: ObjectMatrix<Nullable<ICellData>>;
    }>;
}
export interface IRuntimeUnitDataPrimitiveType {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
    }>;
}
export interface IRuntimeOtherUnitDataType {
    [unitId: string]: Nullable<{
        [sheetId: string]: Nullable<{
            [formulaId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>[][]>;
        }>;
    }>;
}
export interface IUnitSheetNameMap {
    [unitId: string]: Nullable<{
        [sheetName: string]: string;
    }>;
}
export type FormulaUnitType = UniverInstanceType.UNIVER_SHEET | UniverInstanceType.UNIVER_BASE;
export interface IFormulaUnitNameMapItem {
    name: string;
    unitType: FormulaUnitType;
}
/** Runtime Unit metadata keyed by stable unitId. */
export interface IFormulaUnitNameMap {
    [unitId: string]: IFormulaUnitNameMapItem;
}
export interface IFormulaExternalReferenceBinding {
    qualifier: string;
    sourceUnitId: string;
    sourceUnitType: FormulaUnitType;
}
export interface IFormulaExternalReferenceResource {
    schemaVersion: number;
    references: Record<string, IFormulaExternalReferenceBinding>;
}
/** Host-scoped External Reference resources keyed by the Host unitId. */
export interface IFormulaExternalReferences {
    [hostUnitId: string]: IFormulaExternalReferenceResource;
}
export interface IUnitSheetIdToNameMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: string;
    }>;
}
export interface IDirtyUnitSheetNameMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: string;
    }>;
}
export interface IDirtyUnitDefinedNameMap {
    [unitId: string]: Nullable<{
        [definedName: string]: string;
    }>;
}
export interface IDirtyUnitSuperTableMap {
    [unitId: string]: Nullable<{
        [tableName: string]: string;
    }>;
}
export interface IDirtyUnitFeatureMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: {
            [featureId: string]: boolean;
        };
    }>;
}
export interface IDirtyUnitOtherFormulaMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: {
            [formulaId: string]: boolean;
        };
    }>;
}
export interface IArrayFormulaRangeType {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectMatrixPrimitiveType<IRange>;
    }>;
}
export interface IArrayFormulaEmbeddedMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectMatrixPrimitiveType<boolean>;
    }>;
}
export interface IFeatureDirtyRangeType {
    [unitId: string]: Nullable<{
        [sheetId: string]: IRange[];
    }>;
}
export interface IRuntimeImageFormulaDataType extends IImageFormulaInfo {
    unitId: string;
    sheetId: string;
    row: number;
    column: number;
}
export interface IUnitImageFormulaDataType {
    [unitId: string]: Nullable<{
        [sheetId: string]: ObjectMatrix<Nullable<IImageFormulaInfo>>;
    }>;
}
export interface IArrayFormulaUnitCellType extends IRuntimeUnitDataPrimitiveType {
}
export interface IFormulaData {
    [unitId: string]: Nullable<{
        [sheetId: string]: Nullable<IObjectMatrixPrimitiveType<Nullable<IFormulaDataItem>>>;
    }>;
}
export interface IFormulaIdMap {
    f: string;
    r: number;
    c: number;
}
export interface IFormulaStringMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectMatrixPrimitiveType<string[]>;
    }>;
}
export interface IFormulaExecuteResultItem {
    value: Nullable<number | string | boolean | Array<Array<number | string | boolean | null>>>;
    formula: string;
}
export interface IFormulaExecuteResultMap {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectMatrixPrimitiveType<IFormulaExecuteResultItem[]>;
    }>;
}
export interface IFormulaIdMapData {
    [unitId: string]: Nullable<{
        [subUnitId: string]: Nullable<{
            [formulaId: string]: IFormulaIdMap;
        }>;
    }>;
}
export interface IOtherFormulaData {
    [unitId: string]: Nullable<{
        [subUnitId: string]: Nullable<{
            [formulaId: string]: IOtherFormulaDataItem;
        }>;
    }>;
}
/**
 * @f  formulaString, the text string of the formula.
 * @si The formula ID can be utilized in scenarios such as copy-pasting and drag-filling to convert formulas into references, eliminating the need for recreating the formulaString.
 */
export interface IFormulaDataItem {
    f: string;
    x?: number;
    y?: number;
    si?: string;
}
export interface IOtherFormulaDataItem {
    f: string;
    ranges: IRange[];
}
export interface ISuperTable {
    sheetId: string;
    titleMap: Map<string, number>;
    range: IRange;
    /**
     * Whether the projected range contains a physical header row.
     * Sheet tables default to true; Base virtual tables store records from row 0.
     */
    showHeader?: boolean;
    /** Whether the projected range contains a physical totals row. */
    showFooter?: boolean;
}
export declare enum TableOptionType {
    ALL = "#All",
    DATA = "#Data",
    HEADERS = "#Headers",
    TOTALS = "#Totals",
    THIS_ROW = "#This Row"
}
export interface IUnitExcludedCell {
    [unitId: string]: Nullable<{
        [sheetId: string]: ObjectMatrix<boolean>;
    }>;
}
export interface IUnitRowData {
    [unitId: string]: Nullable<{
        [sheetId: string]: IObjectArrayPrimitiveType<Partial<IRowData> & {
            filtered?: boolean;
        }>;
    }>;
}
export interface IFormulaDatasetConfig {
    formulaData: IFormulaData;
    arrayFormulaCellData: IArrayFormulaUnitCellType;
    arrayFormulaRange: IArrayFormulaRangeType;
    forceCalculate: boolean;
    dirtyRanges: IUnitRange[];
    dirtyNameMap: IDirtyUnitSheetNameMap;
    dirtyDefinedNameMap: IDirtyUnitDefinedNameMap;
    dirtySuperTableMap?: IDirtyUnitSuperTableMap;
    dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
    dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
    clearDependencyTreeCache?: IUnitSheetIdToNameMap;
    excludedCell?: IUnitExcludedCell;
    allUnitData?: IUnitData;
    unitStylesData?: IUnitStylesData;
    unitSheetNameMap?: IUnitSheetNameMap;
    unitNameMap?: IFormulaUnitNameMap;
    externalReferences?: IFormulaExternalReferences;
    maxIteration?: number;
    isCalculateTreeModel?: boolean;
    rowData?: IUnitRowData;
}
export declare enum ConcatenateType {
    FRONT = 0,
    BACK = 1
}
export interface IExprTreeNode {
    value: string;
    children: IExprTreeNode[];
    startIndex: number;
    type?: sequenceNodeType;
}
