import type { IChartBuilderTypeMap } from '@univerjs-pro/engine-chart/facade';
import type { IPivotChartControls, PivotChartTypeString } from '@univerjs-pro/pivot-chart';
import type { ChartAnchorSpec } from '@univerjs-pro/sheets-chart';
import type { IPivotChartTableSourceSpec, ISheetPivotChartInfo, PivotChartRangeInput, PivotChartSourceSpec } from '@univerjs-pro/sheets-pivot-chart';
import type { FPivotTable } from '@univerjs-pro/sheets-pivot/facade';
type PivotChartUnsafeBuilderMethod = 'setSource' | 'setCategoryField' | 'setCategoryFields' | 'clearCategoryField' | 'clearCategoryFields' | 'setMultiLevelCategoryAxis' | 'setValueFields' | 'clearValueFields' | 'setAggregation' | 'clearAggregation';
type PivotChartEngineBuilder<T extends PivotChartTypeString> = Omit<IChartBuilderTypeMap<PivotChartRangeInput, PivotChartSourceSpec, ISheetPivotChartInfo>[T], PivotChartUnsafeBuilderMethod>;
type RebindPivotChartBuilder<TBuilder, TExtension> = {
    [K in keyof TBuilder]: TBuilder[K] extends (...args: infer TArgs) => infer TResult ? TResult extends TBuilder ? (...args: TArgs) => RebindPivotChartBuilder<TBuilder, TExtension> & TExtension : (...args: TArgs) => TResult : TBuilder[K];
};
interface ISheetPivotChartBuilderExtensionMethods {
    /**
     * Links the new PivotChart to an existing PivotTable-owned report.
     * @param {FPivotTable} pivotTable The PivotTable that owns the shared PivotModel.
     * @returns {this} This Builder for chaining.
     */
    setPivotTable(pivotTable: FPivotTable): this;
    /**
     * Links the new PivotChart using a stable PivotTable reference.
     * @param {IPivotChartTableSourceSpec['pivotTableRef']} pivotTableRef The referenced PivotTable identity.
     * @returns {this} This Builder for chaining.
     */
    setPivotTableReference(pivotTableRef: IPivotChartTableSourceSpec['pivotTableRef']): this;
    /**
     * Sets the worksheet cell anchor used when inserting the PivotChart.
     * @param {ChartAnchorSpec} anchor A1 notation or a zero-based row and column anchor.
     * @returns {this} This Builder for chaining.
     */
    setPosition(anchor: ChartAnchorSpec): this;
    /**
     * Sets the optional user-facing PivotChart name.
     * @param {string} name The PivotChart name.
     * @returns {this} This Builder for chaining.
     */
    setName(name: string): this;
    /**
     * Merges persisted PivotChart button visibility controls.
     * @param {Partial<IPivotChartControls>} controls The controls to override.
     * @returns {this} This Builder for chaining.
     */
    setControls(controls: Partial<IPivotChartControls>): this;
    /**
     * Shows or hides Pivot field buttons.
     * @param {boolean} visible Whether field buttons are visible.
     * @returns {this} This Builder for chaining.
     */
    setFieldButtonsVisible(visible: boolean): this;
    /**
     * Shows or hides category hierarchy expand and collapse buttons.
     * @param {boolean} visible Whether expand and collapse buttons are visible.
     * @returns {this} This Builder for chaining.
     */
    setExpandCollapseButtonsVisible(visible: boolean): this;
}
export interface ISheetPivotChartBuilderMethods extends ISheetPivotChartBuilderExtensionMethods {
    /**
     * Sets a range source that creates an independently owned PivotModel.
     *
     * A local A1 string and an `IRange` are resolved against the worksheet that created the Builder.
     * A complete range identity can reference another worksheet in the supported Unit boundary.
     *
     * @param {PivotChartRangeInput} source The range source.
     * @returns {this} This Builder for chaining.
     */
    setSource(source: PivotChartRangeInput): this;
}
/** A type-specific PivotChart Builder with worksheet insertion options. */
export type FSheetPivotChartBuilderOf<T extends PivotChartTypeString> = RebindPivotChartBuilder<PivotChartEngineBuilder<T>, ISheetPivotChartBuilderMethods> & ISheetPivotChartBuilderMethods;
/** A prelinked PivotChart Builder whose report source cannot be replaced. */
export type FLinkedSheetPivotChartBuilderOf<T extends PivotChartTypeString> = Omit<FSheetPivotChartBuilderOf<T>, 'setSource' | 'setPivotTable' | 'setPivotTableReference'>;
/** A Builder copied from a live PivotChart whose report source cannot be replaced. */
export type FBoundSheetPivotChartBuilderOf<T extends PivotChartTypeString> = FLinkedSheetPivotChartBuilderOf<T>;
export {};
