import { RemoveListener } from "@sheetxl/common";
import { SerializableProperties } from "../primitives";
import { SheetCellRangeCoordsAddresses, SheetCellRangeCoords, SheetCellCoords } from "../range";
import { NamedItem } from "./NamedItem";
export interface NamedRangeItem extends NamedItem<SheetCellRangeCoords> {
    type: 'sheet';
}
export interface NamedTableItem extends NamedItem<SheetCellRangeCoords> {
    type: 'table';
}
export type NamedItemsJSON = SerializableProperties<NamedItem<SheetCellRangeCoords>>[];
export interface INamedItemsListener {
    /**
     * Called when the named ranges change
     */
    onNamedItemsChange?(source: INamedItems): void;
    onClose?(source: INamedItems): void;
}
export interface NamedItemsSearchOptions {
    /**
     * A string indicating the type
     */
    type?: string;
    /**
     * Scope specified this will return only scope and global ranges.
     * If not specified then will return only global ranges.
     * @remarks
     * Special case if scope === 'all' then will return all ranges.
     */
    scope?: string | 'all';
    bounds?: SheetCellRangeCoords;
    /**
     * If true will return any NameItem that is in the bounds even if only partially @defaultValue false
     */
    allowExtrudes?: boolean;
}
/**
 * Holds a collection of named ranges
 */
export interface INamedItems {
    /**
     * Search the named items.
     * These are sorted by type then by name.
     */
    search(options?: NamedItemsSearchOptions): NamedItem[];
    /**
     * Lookup a named range with a given name.
     * @remarks
     * This is case insensitive.
     */
    lookupByName(name: string, anchor: SheetCellCoords): NamedItem | null;
    /**
     * Lookup a named range by SheetRangeCoords. This will only
     * return a match if all the ranges are exact matches.
     */
    lookupByRanges(ranges: SheetCellRangeCoords[], anchor: SheetCellCoords): NamedItem[] | null;
    /**
     * Validate that the NamedItem. This is identical to addNamedItem
     * but without actually trying.
     * @remarks
     * This will throw an error if the sheetName is invalid.
     * @param namedRangeItem The range to validate
     * @param replaceHidden If true then won't check to see if the name is already used for hidden ranges. @defaultValue true
     * @param scope The scope of the range. @defaultValue null
     */
    validateNamedItem(namedRangeItem: SerializableProperties<NamedRangeItem>, scope?: string, replaceHidden?: boolean): void;
    /**
     * Given the name return a valid name that closely matches.
     */
    findValidateName(ranges: SheetCellRangeCoords[], scope?: string, template?: string, replaceHidden?: boolean): string;
    /**
     * Returns a set of ranges from an address. Will return null if not a valid address.
     * @remarks
     * This does not resolved named ranges.
     * @param address
     */
    decodeAddress(address: SheetCellRangeCoordsAddresses): SheetCellRangeCoords[] | null;
    /**
     * Add a named range.
     * This is case insensitive; must be unique, and must not have any spaces.
     * This will throw an error if the name is invalid or already exists,
     * @param namedRange
     * @param replaceHidden If true will replace hidden ranges if one already exists. @defaultValue true
     */
    addNamedRange(namedRange: SerializableProperties<NamedRangeItem> | string, replaceHidden?: boolean): NamedRangeItem;
    /**
     * Updates a named range. This allows for the original name to be changed.
     * @param name The original name
     * @param namedRange
     */
    updateNamedRange(name: string, namedRange: SerializableProperties<NamedRangeItem>): NamedRangeItem;
    /**
     * Remove a named range.
     * @param namedRange The range to remove
     */
    deleteNamedRange(namedRange: NamedRangeItem | string): NamedRangeItem | null;
    /**
     * Listen for changes to the named ranges.
     * @param listener
     */
    addListener(listener: INamedItemsListener): RemoveListener;
    /**
     * Serialize the state
     */
    toJSON(): NamedItemsJSON | null;
    /**
     * Loads value from JSON, this will clear any existing state
     * @param json
     */
    fromJSON(json: NamedItemsJSON): void;
    /**
     * Used for runtime reflection.
     */
    isNamedItems: true;
}
//# sourceMappingURL=INamedItems.d.ts.map