import type { Exception } from '@api-client/core/exceptions/exception.js';
/**
 * Defines the options for the retry mechanism.
 */
export interface RetryOptions {
    /**
     * The maximum number of retry attempts.
     * Defaults to 3.
     */
    retries?: number;
    /**
     * The delay in milliseconds before the next retry.
     * Can be a fixed number or a function that returns a number (e.g., for exponential backoff).
     * Defaults to 1000ms.
     */
    delayMs?: number | ((attempt: number) => number);
    /**
     * An optional function that determines if a retry should be attempted based on the error.
     * If not provided, all errors will trigger a retry up to the maximum number of retries.
     * @param error The error that occurred.
     * @returns True if a retry should be attempted, false otherwise.
     */
    shouldRetry?: (error: Error) => boolean;
}
/**
 * Calculates an exponential backoff delay for retry attempts.
 * The delay doubles with each attempt.
 *
 * @param attempt The current retry attempt number (should be 1-indexed).
 * @param initialDelay The initial delay in milliseconds. Defaults to 1000ms.
 * @returns The calculated delay in milliseconds.
 */
export declare function exponentialBackoffDelay(attempt: number, initialDelay?: number): number;
/**
 * Checks if the API error should be retried based on its status code.
 * If the status code is 404, it returns false (do not retry).
 * For other status codes, it returns true (retry).
 * @param error The error to check.
 */
export declare function shouldRetryApiError(error: Exception): boolean;
/**
 * The base class for models.
 *
 * Models wrap a logic related to manipulating model data, querying for data from the API,
 * retry logic, cashing, refreshing of data, offline storage, pooling endpoints for new data, etc.
 *
 * The application should use these models in order to centralize object manipulation.
 *
 * @template T The underlying domain model.
 */
export declare abstract class Model<T> extends EventTarget {
    #private;
    /**
     * The underlying raw object.
     * Do not modify properties of the object directly.
     * Use one of the methods provided by the model.
     * Direct changes will not be reflected in the UI
     * and may cause issues when processing the object.
     */
    raw?: T;
    /**
     * The timeout for the query debouncer.
     * When any property change this is the time the element will wait
     * until the actual query is made.
     */
    debounceTimeout: number;
    /**
     * A reference to the current debouncer.
     */
    debouncerValue?: number | NodeJS.Timeout;
    /**
     * Default limit for list queries.
     */
    limit: number;
    /**
     * @type A promise resolved when the debounced task finished.
     */
    get taskComplete(): Promise<void> | undefined;
    /**
     * A getter for the raw value.
     */
    get value(): T | undefined;
    /**
     * @param obj The source object to use.
     */
    constructor(obj?: T);
    /**
     * Creates a new instance of the data. It often invokes API call.
     * This is what happens after the user triggers "create new" flow.
     *
     * After this method is calls, the `raw` object is set.
     *
     * @param data The partial data to create.
     * @returns The created object.
     */
    create(data: Partial<T>): Promise<T>;
    debounce(callback: (...args: unknown[]) => unknown): void;
    notifyError(error: Error): void;
    protected resolveTaskPromise(): void;
    /**
     * Executes an asynchronous operation with a retry mechanism.
     * @param operation A function that returns a Promise to be executed.
     * @param options Optional retry configurations.
     * @returns A Promise that resolves with the result of the operation or rejects if all retries fail.
     * @example
     * ```typescript
     * override async create(data: Partial<IUser>): Promise<IUser> {
     *   const operation = async (): Promise<UserData> => {
     *     // ... perform API call to create user
     *   }
     *   const retryOptions: RetryOptions = {
     *     retries: 5,
     *     delayMs: exponentialBackoffDelay,
     *     shouldRetry: shouldRetryApiError,
     *   }
     *   this.raw = await this.retry(operation)
     *   this.dispatchEvent(new CustomEvent('data-changed', { detail: this.raw }))
     *   return this.raw;
     * }
     * ```
     */
    protected retry<R>(operation: () => Promise<R>, options?: RetryOptions): Promise<R>;
}
//# sourceMappingURL=Model.d.ts.map