import { TypedResponse } from '../../http';
import { DeleteUserSetting, UpsertUserSetting, UserSettingListResults } from './UserSetting';

/**
 * API for managing user specific settings
 */
export interface UserSettingApCLient {
    /**
     * Looks for settings belonging to the current user, starting at path, and then recursively down the hierarchy.
     *
     * Example:
     * There are settings at
     * a
     * a/b
     * a/b/c
     *
     * path = 'a', maxLevels = 0 will return the setting at 'a'
     * path = 'a', maxLevels = 1 will return the settings at 'a' and 'a/b'
     * path = 'a', maxLevels = 2 will return the settings at 'a', 'a/b', 'a/b/c'
     * path = 'a/b', maxLevels = 1 will return the settings at 'a/b' and 'a/b/c'
     * path = 'b' will not return any setting
     * @param path Slash separated path to setting
     * @param maxLevels Maximum recursion level when traversing the setting hierarchy. Default = 0 (current level)
     */
    get<T>(path: string, maxLevels?: number): Promise<TypedResponse<UserSettingListResults<T>>>;

    /**
     * Set the setting at the given path. If a setting already exists at the given path, an up-to-date etag must
     * be provided in order to prevent concurrency issues
     * @param upsertUserSetting The setting to upsert
     */
    upsert<T>(upsertUserSetting: UpsertUserSetting<T>): Promise<Response>;
    /**
     * Deletes the setting at the given path. An up-to-date etag must be provided in order to prevent concurrency issues
     * @param deleteUserSetting The setting to delete
     */
    delete(deleteUserSetting: DeleteUserSetting): Promise<Response>;
}
