import Sdk from '../sdk';
import { AirtableInterface } from '../types/airtable_interface';
import { ModelChange } from '../types/base';
import { CollaboratorData, UserId } from '../types/collaborator';
import { PermissionLevel } from '../types/permission_levels';
import { ObjectValues, ObjectMap } from '../private_utils';
import { PermissionCheckResult } from '../types/mutations';
import AbstractModel from './abstract_model';
/** @hidden */
interface SessionData {
    currentUserId: UserId | null;
    permissionLevel: PermissionLevel;
    enabledFeatureNames: Array<string>;
}
declare const WatchableSessionKeys: Readonly<{
    permissionLevel: "permissionLevel";
    currentUser: "currentUser";
}>;
/**
 * Watchable keys in {@link Session}.
 * - `currentUser`
 * - `permissionLevel`
 */
declare type WatchableSessionKey = ObjectValues<typeof WatchableSessionKeys>;
/**
 * Model class representing the current user's session.
 *
 * @example
 * ```js
 * import {useSession} from '@airtable/blocks/ui';
 *
 * function Username() {
 *     const session = useSession();
 *
 *     if (session.currentUser !== null) {
 *         return <span>The current user's name is {session.currentUser.name}</span>;
 *     } else {
 *         return <span>This app is being viewed in a public share</span>;
 *     }
 * }
 * ```
 * @docsPath models/Session
 */
declare class Session extends AbstractModel<SessionData, WatchableSessionKey> {
    /** @internal */
    static _className: string;
    /** @internal */
    static _isWatchableKey(key: string): boolean;
    /** @internal */
    _airtableInterface: AirtableInterface;
    /** @internal */
    _sessionData: SessionData;
    /**
     * @internal
     */
    constructor(sdk: Sdk);
    /**
     * @internal
     */
    get _dataOrNullIfDeleted(): SessionData;
    /**
     * The current user, or `null` if the app is running in a publicly shared base.
     *
     * @example
     * ```js
     * import {useSession} from '@airtable/blocks/ui';
     *
     * function CurrentUser() {
     *     const session = useSession();
     *
     *     if (!session.currentUser) {
     *         return <div>This app is being used in a public share.</div>;
     *     }
     *
     *     return <ul>
     *         <li>ID: {session.currentUser.id}</li>
     *         <li>E-mail: {session.currentUser.email}</li>
     *         <li>Name: {session.currentUser.name}</li>
     *     </ul>;
     * }
     * ```
     */
    get currentUser(): CollaboratorData | null;
    /**
     * Checks whether the current user has permission to update any records in the current base. For
     * more granular permission checks, see {@link Table.checkPermissionsForUpdateRecords}.
     *
     * Returns `{hasPermission: true}` if the current user can update records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may
     * be used to display an error message to the user.
     *
     * @example
     * ```js
     * import {useSession} from '@airtable/blocks/ui';
     *
     * function UpdateButton({onClick}) {
     *     const session = useSession();
     *     const updateRecordsCheckResult = session.checkPermissionsForUpdateRecords();
     *     const deniedReason = updateRecordsCheckResult.hasPermission
     *         ? <span>{updateRecordsCheckResult.reasonDisplayString}</span>
     *         : null;
     *
     *     return <div>
     *         {deniedReason}
     *         <button onClick={onClick} disabled={!!deniedReason}>
     *             Update
     *         </button>
     *     </div>;
     * }
     */
    checkPermissionsForUpdateRecords(): PermissionCheckResult;
    /**
     * An alias for `session.checkPermissionsForUpdateRecords().hasPermission`. For more granular
     * permission checks, see {@link Table.hasPermissionToUpdateRecords}.
     */
    hasPermissionToUpdateRecords(): boolean;
    /**
     * Checks whether the current user has permission to create any records in the current base. For
     * more granular permission checks, see {@link Table.checkPermissionsForCreateRecords}.
     *
     * Returns `{hasPermission: true}` if the current user can create records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @example
     * ```js
     * import {useSession} from '@airtable/blocks/ui';
     *
     * function CreateButton({onClick}) {
     *     const session = useSession();
     *     const updateRecordsCheckResult = session.checkPermissionsForCreateRecords();
     *     const deniedReason = updateRecordsCheckResult.hasPermission
     *         ? <span>{updateRecordsCheckResult.reasonDisplayString}</span>
     *         : null;
     *
     *     return <div>
     *         {deniedReason}
     *         <button onClick={onClick} disabled={!!deniedReason}>
     *             Create
     *         </button>
     *     </div>;
     * }
     */
    checkPermissionsForCreateRecords(): PermissionCheckResult;
    /**
     * An alias for `session.checkPermissionsForCreateRecords().hasPermission`. For more granular
     * permission checks, see {@link Table.hasPermissionToCreateRecords}.
     */
    hasPermissionToCreateRecords(): boolean;
    /**
     * Checks whether the current user has permission to delete any records in the current base. For
     * more granular permission checks, see {@link Table.checkPermissionsForDeleteRecords}.
     *
     * Returns `{hasPermission: true}` if the current user can delete records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @example
     * ```js
     * import {useSession} from '@airtable/blocks/ui';
     *
     * function DeleteButton({onClick}) {
     *     const session = useSession();
     *     const updateRecordsCheckResult = session.checkPermissionsForDeleteRecords();
     *     const deniedReason = updateRecordsCheckResult.hasPermission
     *         ? <span>{updateRecordsCheckResult.reasonDisplayString}</span>
     *         : null;
     *
     *     return <div>
     *         {deniedReason}
     *         <button onClick={onClick} disabled={!!deniedReason}>
     *             Delete
     *         </button>
     *     </div>;
     */
    checkPermissionsForDeleteRecords(): PermissionCheckResult;
    /**
     * An alias for `session.checkPermissionsForDeleteRecords().hasPermission`. For more granular
     * permission checks, see {@link Table.hasPermissionToDeleteRecords}.
     */
    hasPermissionToDeleteRecords(): boolean;
    /**
     * Returns true if `featureName` is enabled and automatically tracks an exposure.
     *
     * @internal
     */
    __isFeatureEnabled(featureName: string): boolean;
    /**
     * Returns true if `featureName` is enabled; does not track an exposure.
     *
     * @internal
     */
    __peekIfFeatureIsEnabled(featureName: string): boolean;
    /**
     * @internal
     */
    __applyChangesWithoutTriggeringEvents(changes: ReadonlyArray<ModelChange>): ObjectMap<WatchableSessionKey, boolean>;
    /**
     * @internal
     */
    __triggerOnChangeForChangedKeys(changedKeys: ObjectMap<WatchableSessionKey, boolean>): void;
}
export default Session;
