/** @packageDocumentation
 * @module QuantityFormatting
 */
import { BeEvent, BeUiEvent, BeUnorderedUiEvent } from "@itwin/core-bentley";
import { AddFormattingSpecArgs, AlternateUnitLabelsProvider, FormatDefinition, FormatProps, FormatsChangedArgs, FormatSpecHandle, FormatsProvider, FormatterSpec, FormattingReadyCollector, FormattingSpecArgs, FormattingSpecEntry, FormattingSpecProvider, ParserSpec, QuantityParseResult, UnitConversionProps, UnitProps, UnitsProvider, UnitSystemKey } from "@itwin/core-quantity";
import { IModelConnection } from "../IModelConnection";
import { CustomFormatPropEditorSpec } from "./QuantityTypesEditorSpecs";
/**
 * Defines standard format types for tools that need to display measurements to user.
 * @public
 */
export declare enum QuantityType {
    /** Length which is stored in meters. Typically formatted to display in meters or feet-inches based on active unit system. */
    Length = 1,
    /** Angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */
    Angle = 2,
    /** Area value store in meters squared. Typically formatted to display in meters squared or feet squared based on active unit system. */
    Area = 3,
    /** Volume value which is stored in meters cubed. Typically formatted to display in meters cubed or feet cubed based on active unit system. */
    Volume = 4,
    /** LatLong is an angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */
    LatLong = 5,
    /** Coordinate/Location value which is stored in meters. Typically formatted to display in meters or feet based on active unit system. */
    Coordinate = 6,
    /** Stationing is a distance value stored in meters. Typically formatted to display `xxx+xx` or `xx+xxx` based on active unit system. */
    Stationing = 7,
    /** LengthSurvey is a distance value stored in meters. Typically formatted to display in meters or US Survey Feet based on active unit system.. */
    LengthSurvey = 8,
    /** LengthEngineering is a distance value stored in meters. Typically formatted to display either meters or feet based on active unit system. */
    LengthEngineering = 9
}
/**
 * Used to uniquely identify the type or quantity. [[QuantityType]] are built-in types and `string` are used for custom quantity types.
 * @public
 */
export type QuantityTypeArg = QuantityType | string;
/** String used to uniquely identify a QuantityType in the quantity registry. See function [[QuantityType.getQuantityTypeKey]].
 * @public
 */
export type QuantityTypeKey = string;
/** String used to uniquely identify a UnitProp.
 * @public
 */
export type UnitNameKey = string;
/**
 * Interface for the properties required to create a FormatterSpec or ParserSpec.
 * @beta
 */
export interface CreateFormattingSpecProps {
    /** The name of the persistence unit. */
    persistenceUnitName: string;
    /** The format properties to use for the spec. */
    formatProps: FormatProps;
    /** Optional name for the format. */
    formatName?: string;
}
/**
 * Class that contains alternate Unit Labels. These labels are used when parsing strings to quantities.
 * One use case is to allow a "^", which is easily input, to be used to specify "°".
 * @internal
 */
export declare class AlternateUnitLabelsRegistry implements AlternateUnitLabelsProvider {
    private _alternateLabelRegistry;
    addAlternateLabels(key: UnitNameKey, ...labels: string[]): void;
    constructor(defaultAlternates?: Map<UnitNameKey, Set<string>>);
    getAlternateUnitLabels(unit: UnitProps): string[] | undefined;
}
/**
 * Function to return a QuantityTypeKey given either a QuantityType enum value or a string. This allows caching and
 * retrieving standard and custom quantity types.
 * @public
 */
export declare function getQuantityTypeKey(type: QuantityTypeArg): QuantityTypeKey;
/**
 * This interface supplies the definition of a `standard` quantity type that is registered with the QuantityFormatter.
 * A `standard` quantity type could be one of the nine delivered QuantityTypes or a CustomQuantityTypeDefinition.
 * @public
 */
export interface QuantityTypeDefinition {
    /** String used as a key to look up the quantity type. If defining a [[CustomQuantityTypeDefinition]] the QuantityTypeKey
     * should match the QuantityTypeArg. */
    readonly key: QuantityTypeKey;
    /** The type value which can be one of the standard QuantityType enum values or a unique string if defining a custom type. */
    readonly type: QuantityTypeArg;
    /** The unit that the magnitude of the quantity is stored ie. (Meter for Length and Radian for Angle). The persistence unit is
     * also used during formatting if the FormatProps does not define one or more composite units.  */
    readonly persistenceUnit: UnitProps;
    /** Localized label to display in UI */
    label: string;
    /** Localized description that may be used to provide detailed description for the Quantity type. */
    description: string;
    getDefaultFormatPropsBySystem: (requestedSystem: UnitSystemKey) => FormatProps;
    /** Async function to generate a [FormatterSpec]$(core-quantity) that will be called to format values.*/
    generateFormatterSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider) => Promise<FormatterSpec>;
    /** Async function to generate a [ParserSpec]$(core-quantity) that will be called to parse a string into a quantity value.*/
    generateParserSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) => Promise<ParserSpec>;
}
/** CustomQuantityTypeDefinition interface is used to define a Custom quantity type that can be registered with the [[QuantityFormatter]].
 * A custom quantity formatter must be able to generate a FormatterSpec and ParserSpec that will be called to format and parse values.
 * Optionally it can provide specification of custom properties that it will use to define any formatting options. CustomQuantityTypeDefinitions
 * must be registered with the [[QuantityFormatter]] using the method `IModelApp.quantityFormatter.registerQuantityType`.
 * @public
 */
export interface CustomQuantityTypeDefinition extends QuantityTypeDefinition {
    /** Return true if the FormatProps have the necessary `custom` property definition */
    isCompatibleFormatProps: (formatProps: FormatProps) => boolean;
    /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.
     * UI items defined as primary will be shown higher in the list of UI components. */
    primaryPropEditorSpecs?: CustomFormatPropEditorSpec[];
    /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.
     * UI items defined as secondary will be shown below other UI components that edit FormatProps. */
    secondaryPropEditorSpecs?: CustomFormatPropEditorSpec[];
}
/** CustomQuantityTypeDefinition type guard.
 * @public
*/
export declare function isCustomQuantityTypeDefinition(item: QuantityTypeDefinition): item is CustomQuantityTypeDefinition;
/** Override format entries can define formats for any of the different unit systems.
 * @public
 */
export interface OverrideFormatEntry {
    /** Override format for "imperial" unit system */
    imperial?: FormatProps;
    /** Override format for "metric" unit system */
    metric?: FormatProps;
    /** Override format for "usCustomary" unit system */
    usCustomary?: FormatProps;
    /** Override format for "usSurvey" unit system */
    usSurvey?: FormatProps;
}
/** Interface that defines the functions required to be implemented to provide custom formatting and parsing of a custom quantity type.
 * @public
 */
export interface FormatterParserSpecsProvider {
    /** Custom quantity id */
    quantityType: QuantityTypeArg;
    /** Async function to return FormatterSpec for a custom quantity type */
    createFormatterSpec: (unitSystem: UnitSystemKey) => Promise<FormatterSpec>;
    /** Async function to return ParserSpec for a custom quantity type */
    createParserSpec: (unitSystem: UnitSystemKey) => Promise<ParserSpec>;
}
/** Arguments sent to FormattingUnitSystemChanged event listeners.
 * @public
 */
export interface FormattingUnitSystemChangedArgs {
    /** string that defines unit system activated. */
    readonly system: UnitSystemKey;
}
/** Arguments sent to QuantityFormatsChanged event listeners.
 * @public
 */
export interface QuantityFormatsChangedArgs {
    /** string that represents the QuantityType that has been overriden or the overrides cleared. */
    readonly quantityType: string;
}
/** Arguments sent to [[UnitFormattingSettingsProvider]] when overrides are changed.
 * @public
 */
export interface QuantityFormatOverridesChangedArgs {
    /** string that represents the QuantityType that has been overriden or the overrides cleared. */
    readonly typeKey: QuantityTypeKey;
    /** overrideEntry will be undefined when clearing overrides */
    readonly overrideEntry?: OverrideFormatEntry;
    /** used only when change applies to a single unit system */
    readonly unitSystem?: UnitSystemKey;
}
/**
 * The UnitFormattingSettingsProvider interface is used to store and retrieve override FormatProps and Presentation Unit System
 * for use by the QuantityFormatter. If no UnitFormattingSettingsProvider is supplied to the QuantityFormatter then any overrides
 * set are lost when the session is closed. The `ui-test-app` has and example implementation that uses browser local storage via the
 * class [[LocalUnitFormatProvider]] [here](https://github.com/iTwin/itwinjs-core/blob/d341e030d4c1427effd80ea54b3d57fec8ad1bc1/test-apps/ui-test-app/src/frontend/index.tsx#L315).
 *  @public
 */
export interface UnitFormattingSettingsProvider {
    /** serializes JSON object containing format overrides for a specific quantity type. */
    store(quantityTypeKey: QuantityTypeKey, overrideProps: OverrideFormatEntry): Promise<boolean>;
    /** retrieves serialized JSON object containing format overrides for a specific quantity type. */
    retrieve(quantityTypeKey: QuantityTypeKey): Promise<OverrideFormatEntry | undefined>;
    /** removes the override formats for a specific quantity type. */
    remove(quantityTypeKey: QuantityTypeKey): Promise<boolean>;
    /** retrieves the active unit system typically based on the "active" iModelConnection */
    retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey>;
    /** store the active unit system typically for the "active" iModelConnection */
    storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean>;
    /** Function to load overrides for a specific IModelConnection. Typically this is not called often since typical
     * implementations monitor for IModelConnection changes and call this method internally. */
    loadOverrides(imodel: IModelConnection | undefined): Promise<void>;
    /** function called to save changes to Presentation Unit System */
    storeUnitSystemSetting(args: FormattingUnitSystemChangedArgs): Promise<void>;
    /** function called to save format overrides */
    storeFormatOverrides(args: QuantityFormatOverridesChangedArgs): Promise<void>;
    /** property that is set by the implementation to inform the BaseUnitFormattingSettingsProvider if the provider
     *  should trigger reloading of the overrides when the "active" imodel changes. */
    readonly maintainOverridesPerIModel: boolean;
}
/**
 * A default formatsProvider, that provides a limited set of [[FormatDefinition]], associated to a few [[KindOfQuantity]].
 * Maps each KindOfQuantity to a [[QuantityType]].
 * When retrieving a valid [[KindOfQuantity]], returns the [[FormatProps]] for the associated [[QuantityType]].
 * @internal
 */
export declare class QuantityTypeFormatsProvider implements FormatsProvider {
    onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
    private _removeListeners;
    constructor();
    [Symbol.dispose](): void;
    private _kindOfQuantityMap;
    getFormat(name: string, _system?: UnitSystemKey): Promise<FormatDefinition | undefined>;
}
/**
 * An implementation of the [[FormatsProvider]] interface that forwards calls to getFormats to the underlying FormatsProvider.
 * Also fires the onFormatsChanged event when the underlying FormatsProvider fires its own onFormatsChanged event.
 * @internal
 */
export declare class FormatsProviderManager implements FormatsProvider {
    private _formatsProvider;
    onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
    private _removeProviderListener?;
    constructor(_formatsProvider: FormatsProvider);
    getFormat(name: string, system?: UnitSystemKey): Promise<FormatDefinition | undefined>;
    get formatsProvider(): FormatsProvider;
    set formatsProvider(formatsProvider: FormatsProvider);
}
/** Class that supports formatting quantity values into strings and parsing strings into quantity values. This class also maintains
 * the "active" unit system and caches FormatterSpecs and ParserSpecs for the "active" unit system to allow synchronous access to
 * parsing and formatting values. The support unit systems are defined by [[UnitSystemKey]] and is kept in synch with the unit systems
 * provided by the Presentation Manager on the backend. The QuantityFormatter contains a registry of quantity type definitions. These definitions implement
 * the [[QuantityTypeDefinition]] interface, which among other things, provide default [[FormatProps]], and provide methods
 * to generate both a [[FormatterSpec]] and a [[ParserSpec]]. There are built-in quantity types that are
 * identified by the [[QuantityType]] enum. [[CustomQuantityTypeDefinition]] can be registered to extend the available quantity types available
 * by frontend tools. The QuantityFormatter also allows the default formats to be overriden.
 *
 * @public
 */
/** Discriminated union describing what a queued reload should do.
 * @internal
 */
type ReloadIntent = {
    scope: "full";
} | {
    scope: "formatsChanged";
    args: FormatsChangedArgs;
} | {
    scope: "activeSystem";
    emitSystemChanged?: boolean;
};
/** The QuantityFormatter class provides methods for formatting and parsing quantities. There are a set of standard quantity types
 * identified by the [[QuantityType]] enum. [[CustomQuantityTypeDefinition]] can be registered to extend the available quantity types available
 * by frontend tools. The QuantityFormatter also allows the default formats to be overriden.
 *
 * @public
 */
export declare class QuantityFormatter implements UnitsProvider, FormattingSpecProvider {
    private static readonly _allUnitSystems;
    private _unitsProvider;
    private _alternateUnitLabelsRegistry;
    /** Registry containing available quantity type definitions. */
    protected _quantityTypeRegistry: Map<QuantityTypeKey, QuantityTypeDefinition>;
    /** Registry containing available FormatterSpec and ParserSpec, mapped by keys.
     * @beta
     */
    protected _formatSpecsRegistry: Map<string, Map<string, Map<UnitSystemKey, FormattingSpecEntry>>>;
    /** Active UnitSystem key - must be one of "imperial", "metric", "usCustomary", or "usSurvey". */
    protected _activeUnitSystem: UnitSystemKey;
    /** Map of FormatSpecs for all available QuantityTypes, keyed by quantity type */
    protected _activeFormatSpecsByType: Map<string, FormatterSpec>;
    /** Map of ParserSpecs for all available QuantityTypes, keyed by quantity type */
    protected _activeParserSpecsByType: Map<string, ParserSpec>;
    /** Map of FormatSpecs that have been overriden from the default. */
    protected _overrideFormatPropsByUnitSystem: Map<UnitSystemKey, Map<string, FormatProps>>;
    /** Optional object that gets called to store and retrieve format overrides. */
    protected _unitFormattingSettingsProvider: UnitFormattingSettingsProvider | undefined;
    /** Set the settings provider and if not iModel specific initialize setting for user. */
    setUnitFormattingSettingsProvider(provider: UnitFormattingSettingsProvider): Promise<void>;
    /** Called after the active unit system is changed.
    * The system will report the UnitSystemKey/name of the the system that was activated.
    */
    readonly onActiveFormattingUnitSystemChanged: BeUiEvent<FormattingUnitSystemChangedArgs>;
    /** Called when the format of a QuantityType is overriden or the override is cleared. The string returned will
     * be a QuantityTypeKey generated by method `getQuantityTypeKey`.
     */
    readonly onQuantityFormatsChanged: BeUiEvent<QuantityFormatsChangedArgs>;
    /** Fired when the active UnitsProvider is updated. This will allow cached Formatter and Parser specs to be updated if necessary. */
    readonly onUnitsProviderChanged: BeUiEvent<void>;
    /** Fired after every reload path completes (initialization, unit system change, provider change, reinitialize).
     * This is the terminal "ready" signal — it fires once the QuantityFormatter has fully rebuilt its caches and is
     * ready to format/parse values. Subscribe to this event to know when formatting specs are available.
     *
     * Uses `BeUnorderedUiEvent` (Set-backed) so listeners can safely add/remove themselves during emit —
     * this is critical for `FormatSpecHandle` instances that subscribe/dispose at volume.
     * @beta
     */
    readonly onFormattingReady: BeUnorderedUiEvent<void>;
    /** Event for formatting providers to register async work before the formatter signals ready.
     * Fires synchronously after each reload completes. Providers should call
     * `collector.addPendingWork(promise)` to register work. The formatter awaits all
     * registered work (with a 20-second default timeout) before emitting [[onFormattingReady]].
     *
     * Use this for **providers** that need async loading. Use [[onFormattingReady]] for
     * **consumers** that read specs.
     * @beta
     */
    readonly onBeforeFormattingReady: BeEvent<(collector: FormattingReadyCollector) => void>;
    /** Whether the QuantityFormatter has completed at least one successful reload and is ready to format/parse.
     * @beta
     */
    get isReady(): boolean;
    /** A promise that resolves after the first successful initialization. This is one-shot — it resolves once
     * and stays resolved forever. For subsequent reloads, subscribe to [[onFormattingReady]].
     *
     * This promise never rejects. If the first initialization attempt fails, it stays pending until a
     * subsequent reload succeeds (e.g., triggered by `setUnitsProvider` or a format change). There is no
     * finite retry limit, so rejection would prematurely close the door on recovery.
     * @beta
     */
    get whenInitialized(): Promise<void>;
    private _isReady;
    private _hasEverBeenReady;
    private _initializedPromise;
    private _resolveInitialized;
    private _reloadInFlight;
    private _pendingReload;
    private _deferredSystemChangedEmit;
    private _removeFormatsProviderListener?;
    /**
     * constructor
     * @param showMetricOrUnitSystem - Pass in `true` to show Metric formatted quantity values. Defaults to Imperial. To explicitly
     * set it to a specific unit system pass a UnitSystemKey.
     */
    constructor(showMetricOrUnitSystem?: boolean | UnitSystemKey);
    [Symbol.dispose](): void;
    /** Schedule an async reload. If no reload is in flight, runs immediately. If a reload is
     * already in flight, stores the intent as pending (latest-wins: only the last scheduled reload
     * is kept). `finalizeReload()` fires only when the queue is fully drained.
     *
     * **Await semantics:** When a reload is already in flight, the returned promise resolves
     * immediately *without* the requested reload having run. Callers that need to know when
     * the reload has actually completed should listen for `onFormattingReady` instead.
     *
     * Reload intents:
     * - `"full"` — rebuild entire registry + re-register provider listener (onInitialized, setUnitsProvider)
     * - `"formatsChanged"` — patch registry from provider + load maps (formatsChanged listener)
     * - `"activeSystem"` — reload format/parsing maps for current unit system (setActiveUnitSystem, reinitializeFormatAndParsingsMaps)
     * @internal
     */
    protected scheduleReload(intent: ReloadIntent): Promise<void>;
    /** Execute the reload work for a given intent. All reload logic is centralized here.
     * @internal
     */
    private _executeReload;
    /** Called when the reload queue is fully drained after a successful reload.
     * Sets `isReady` to true, resolves `whenInitialized` (one-shot), and emits ready events.
     * @internal
     */
    private finalizeReload;
    private getOverrideFormatPropsByQuantityType;
    /** Method used to register all QuantityTypes defined in QuantityType enum. */
    protected initializeQuantityTypesRegistry(): Promise<void>;
    /** Asynchronous call to load Formatting and ParsingSpecs for a unit system. This method ends up caching FormatterSpecs and ParserSpecs
     *  so they can be quickly accessed.
     * @internal public for unit test usage
     */
    protected loadFormatAndParsingMapsForSystem(systemType?: UnitSystemKey): Promise<void>;
    private getFormatPropsByQuantityTypeEntryAndSystem;
    private loadFormatAndParserSpec;
    private loadDefaultFormatAndParserSpecForQuantity;
    private setOverrideFormatsByQuantityTypeKey;
    /** Method called to clear override and restore defaults formatter and parser spec */
    private clearOverrideFormatsByQuantityTypeKey;
    /** This method is called during IModelApp initialization to load the standard quantity types into the registry and to initialize the cache.
     * @internal
     */
    onInitialized(): Promise<void>;
    /** Core reload logic — does all async I/O and cache rebuilding without events or state management.
     * @internal
     */
    private _reloadCore;
    /** Rebuild the formatting specs registry from the current formatsProvider based on changed args.
     * @internal
     */
    private _rebuildRegistryFromProvider;
    /** Rebuild all system entries for a single KoQ name in the registry. */
    private _rebuildRegistryForName;
    /** Return a map that serves as a registry of all standard and custom quantity types. */
    get quantityTypesRegistry(): Map<string, QuantityTypeDefinition>;
    /** Return the class the contain map of all alternate labels for units. These alternate labels are used when parsing strings in quantity values. */
    get alternateUnitLabelsProvider(): AlternateUnitLabelsProvider;
    /**
     * Add one or more alternate labels for a unit - these labels are used during string parsing.
     * @param key UnitNameKey which comes from `UnitProps.name`
     * @param labels one or more unit labels
     */
    addAlternateLabels(key: UnitNameKey, ...labels: string[]): void;
    /** Get/Set the active UnitsProvider class. */
    get unitsProvider(): UnitsProvider;
    set unitsProvider(unitsProvider: UnitsProvider);
    /**
     * Async method to set a units provider and reload caches.
     * @note If the active primitive tool may be holding stale unit data, callers should follow this with
     * `IModelApp.toolAdmin.restartPrimitiveTool()` to allow the tool to reinitialize itself.
     */
    setUnitsProvider(unitsProvider: UnitsProvider): Promise<void>;
    /**
     * Async call typically used after an iModel is closed to reset the UnitsProvider to the default one
     * that does not require a Units schema.
     * @note If the active primitive tool may be holding stale unit data, callers should follow this with
     * `IModelApp.toolAdmin.restartPrimitiveTool()` to allow the tool to reinitialize itself.
     */
    resetToUseInternalUnitsProvider(): Promise<void>;
    /** Async call to register a CustomQuantityType and load the FormatSpec and ParserSpec for the new type. */
    registerQuantityType(entry: CustomQuantityTypeDefinition, replace?: boolean): Promise<boolean>;
    /** Reinitialize caches. Typically called by active UnitFormattingSettingsProvider.
     * startDefaultTool - set to true to start the Default to instead of leaving any active tool pointing to cached unit data that is no longer valid
     * @public
     */
    reinitializeFormatAndParsingsMaps(overrideFormatPropsByUnitSystem: Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>, unitSystemKey?: UnitSystemKey, fireUnitSystemChanged?: boolean, startDefaultTool?: boolean): Promise<void>;
    /** Set the Active unit system to one of the supported types. This will asynchronously load the formatter and parser specs for the activated system. */
    setActiveUnitSystem(isImperialOrUnitSystem: UnitSystemKey | boolean, restartActiveTool?: boolean): Promise<void>;
    /** Retrieve the active [[UnitSystemKey]] which is used to determine what formats are to be used to display quantities */
    get activeUnitSystem(): UnitSystemKey;
    /** Clear any formatting override for specified quantity type, but only for the "active" Unit System. */
    clearOverrideFormats(type: QuantityTypeArg): Promise<void>;
    /** Set formatting override for specified quantity type, but only for the "active" Unit System. */
    setOverrideFormats(type: QuantityTypeArg, overrideEntry: OverrideFormatEntry): Promise<void>;
    /** Set Override Format for a quantity type, but only in the "active" Unit System. */
    setOverrideFormat(type: QuantityTypeArg, overrideFormat: FormatProps): Promise<void>;
    /** Clear formatting override for all quantity types, but only for the "active" Unit System. */
    clearAllOverrideFormats(): Promise<void>;
    /** Converts a QuantityTypeArg into a QuantityTypeKey/string value that can be used to lookup custom and standard quantity types. */
    getQuantityTypeKey(type: QuantityTypeArg): string;
    /** Return [[QuantityTypeDefinition]] if type has been registered. Standard QuantityTypes are automatically registered. */
    getQuantityDefinition(type: QuantityTypeArg): QuantityTypeDefinition | undefined;
    /** Synchronous call to get a FormatterSpec of a QuantityType. If the FormatterSpec is not yet cached an undefined object is returned. The
     * cache is populated by the async call loadFormatAndParsingMapsForSystem.
     */
    findFormatterSpecByQuantityType(type: QuantityTypeArg, _unused?: boolean): FormatterSpec | undefined;
    /** Asynchronous Call to get a FormatterSpec for a QuantityType. This formatter spec can be used to synchronously format quantities. */
    generateFormatterSpecByType(type: QuantityTypeArg, formatProps: FormatProps): Promise<FormatterSpec>;
    /** Asynchronous Call to get a FormatterSpec for a QuantityType and a Unit System. This formatter spec can be used to synchronously format quantities.
     * @param type        One of the built-in quantity types supported.
     * @param system      Requested unit system key. Note it is more efficient to use setActiveUnitSystem to set up formatters for all
     * quantity types of a unit system.
     * @return A FormatterSpec Promise.
     */
    getFormatterSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<FormatterSpec | undefined>;
    /** Asynchronous Call to get a FormatterSpec for a QuantityType.
     * @param type        One of the built-in quantity types supported.
     * @param isImperial  Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.
     * @return A FormatterSpec Promise.
     */
    getFormatterSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<FormatterSpec | undefined>;
    /** Synchronous call to get a ParserSpec for a QuantityType. If the ParserSpec is not yet cached an undefined object is returned. The
     * cache is populated when the active units system is set.
     */
    findParserSpecByQuantityType(type: QuantityTypeArg): ParserSpec | undefined;
    /** Asynchronous Call to get a ParserSpec for a QuantityType. If the UnitSystemKey is not specified the active Unit System is used. **/
    getParserSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<ParserSpec | undefined>;
    /** Asynchronous Call to get a ParserSpec for a QuantityType.
     * @param type        One of the built-in quantity types supported.
     * @param isImperial  Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.
     * @return A FormatterSpec Promise.
     */
    getParserSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<ParserSpec | undefined>;
    /** Generates a formatted string asynchronously for a quantity given the provided properties.
     * @param props - an object containing value, valueUnitName, and kindOfQuantityName.
     * @return A promise resolving to a formatted string.
     */
    formatQuantity(props: {
        value: number;
        valueUnitName: string;
        kindOfQuantityName: string;
    }): Promise<string>;
    /** Generates a formatted string for a quantity given its format spec.
     * @param magnitude       The magnitude of the quantity.
     * @param formatSpec      The format specification. See methods getFormatterSpecByQuantityType and findFormatterSpecByQuantityType.
     * @return a formatted string.
     */
    formatQuantity(magnitude: number, formatSpec?: FormatterSpec): string;
    private formatQuantityAsync;
    /** Parse input string asynchronously into a quantity given the provided properties.
     * @param props - an object containing value, valueUnitName, and kindOfQuantityName.
     * @return Promise resolving to a QuantityParseResult object containing either the parsed value or an error value if unsuccessful.
     */
    parseToQuantityValue(props: {
        value: string;
        valueUnitName: string;
        kindOfQuantityName: string;
    }): Promise<QuantityParseResult>;
    /** Parse input string into quantity given the ParserSpec
     * @param inString       The magnitude of the quantity.
     * @param parserSpec     The parse specification the defines the expected format of the string and the conversion to the output unit.
     * @return QuantityParseResult object containing either the parsed value or an error value if unsuccessful.
     */
    parseToQuantityValue(inString: string, parserSpec?: ParserSpec): QuantityParseResult;
    private parseToQuantityValueAsync;
    /**
     * Get a UnitSystemKey from a string that may have been entered via a key-in. Supports different variation of
     * unit system names that have been used in the past.
     */
    getUnitSystemFromString(inputSystem: string, fallback?: UnitSystemKey): UnitSystemKey;
    /** Return true if the QuantityType is using an override format. */
    hasActiveOverride(type: QuantityTypeArg, checkOnlyActiveUnitSystem?: boolean): boolean;
    /** Get the cached FormatProps give a quantity type. If ignoreOverrides is false then if the format has been overridden
     * the overridden format is returned, else the standard format is returned.
     */
    getFormatPropsByQuantityType(quantityType: QuantityTypeArg, requestedSystem?: UnitSystemKey, ignoreOverrides?: boolean): FormatProps | undefined;
    /** Find [UnitProp] for a specific unit label. */
    findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps>;
    /** Returns all defined units for the specified Unit Family/Phenomenon. */
    getUnitsByFamily(phenomenon: string): Promise<UnitProps[]>;
    /** Find [UnitProp] for a specific unit name. */
    findUnitByName(unitName: string): Promise<UnitProps>;
    /** Returns data needed to convert from one Unit to another in the same Unit Family/Phenomenon. */
    getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps>;
    /**
     * Creates a [[FormatterSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.
     * @beta
     * @param props - A [[CreateFormattingSpecProps]] interface.
     */
    createFormatterSpec(props: CreateFormattingSpecProps): Promise<FormatterSpec>;
    /**
     * Creates a [[ParserSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.
     * @beta
     * @param props - A [[CreateFormattingSpecProps]] object.
     */
    createParserSpec(props: CreateFormattingSpecProps): Promise<ParserSpec>;
    /**
     * @beta
     * Returns a map of [[FormattingSpecEntry]] keyed by persistence unit for a given name, typically a KindOfQuantity full name.
     */
    getSpecsByName(name: string): ReadonlyMap<string, FormattingSpecEntry> | undefined;
    /**
     * Returns a [[FormattingSpecEntry]] for a given name and persistence unit.
     * @beta
     */
    getSpecsByNameAndUnit(args: FormattingSpecArgs): FormattingSpecEntry | undefined;
    /** Create a cacheable handle to formatting specs for a specific KoQ and persistence unit.
     * The handle auto-refreshes when the QuantityFormatter reloads. Call `dispose()` when done.
     *
     * @param koqName - The KindOfQuantity name (e.g., "DefaultToolsUnits.LENGTH")
     * @param persistenceUnit - The persistence unit name (e.g., "Units.M")
     * @returns A FormatSpecHandle that auto-updates on reload
     * @beta
     */
    getFormatSpecHandle(koqName: string, persistenceUnit: string, system?: UnitSystemKey): FormatSpecHandle;
    /**
   * Populates the registry with a new FormatterSpec and ParserSpec entry for the given format name.
   * @beta
   */
    addFormattingSpecsToRegistry(args: AddFormattingSpecArgs): Promise<void>;
}
export {};
//# sourceMappingURL=QuantityFormatter.d.ts.map