import { LitElement, TemplateResult, nothing } from 'lit';
import type { AccessOperation, IPermission } from '@api-client/core/models/store/Permission.js';
import type { IUser } from '@api-client/core/models/store/User.js';
import type { PermissionRole } from '@api-client/core/models/store/Permission.js';
/**
 * An element that manages the internal state and logic for sharing a file.
 *
 * This component handles the different states of the file sharing process, including initialization,
 * readiness, error handling, and committing changes. However, the component does not implement any API calls.
 * The hosting application is responsible for performing the actual file sharing operations.
 *
 * The component is not 100% complete. Pending features include:
 * - Permissions on groups.
 * - Sharing with the organization.
 * - Moving ownership to another user.
 *
 * @fires search-users - Dispatched when the user types in the search input.
 *                     The detail object contains the `query` string.
 * @fires grant-changed - Dispatched when the grant type for new shares is changed.
 *                      The detail object contains the `grant` role.
 * @fires pending-changed - Dispatched when a permission change for an existing user is staged.
 *                        The detail object contains the `pending` map of operations.
 */
export default class ShareFile extends LitElement {
    /**
     * The users available for sharing.
     * This property should be set by the hosting application in response to `search-users` events.
     */
    accessor userSuggestions: IUser[];
    /**
     * The current grant/permission role for new shares.
     *
     * @attribute
     */
    accessor grant: PermissionRole;
    /**
     * The users that already have permissions.
     */
    accessor permissionUsers: IUser[];
    /**
     * The existing permissions on the file(s).
     *
     * - When there's only one file, this will contain the existing permissions for that file.
     * - When multiple files are being shared, this will contain the common permissions
     *   that can be set for all files.
     */
    accessor permissions: IPermission[];
    /**
     * A flag indicating whether multiple files are being shared.
     * @attribute
     */
    accessor multiple: boolean;
    /**
     * Pending operations that haven't been committed yet
     */
    accessor pending: Map<string, AccessOperation>;
    /**
     * A map to store user details for pending add operations.
     */
    protected accessor _addedUsers: Map<string, IUser>;
    /**
     * An error message to display when the `currentState` is set to `Error`.
     * @attribute
     */
    accessor error: string | undefined;
    /**
     * A handler for the input event on the user search field.
     * Dispatches the `search-users` event.
     *
     * @param event The input event
     */
    protected handleNameInput(event: InputEvent): void;
    /**
     * A handler for the keydown event on the user search field.
     * It focuses on the last selected user when Backspace is pressed and the input is empty.
     *
     * @param event The keyboard event
     */
    protected handleNameInputKeydown(event: KeyboardEvent): void;
    /**
     * A handler for keydown events on the user suggestions list.
     * Stops propagation of the Escape key to prevent closing parent dialogs unexpectedly.
     *
     * @param event The keyboard event
     */
    protected handleUserSuggestionsKeydown(event: KeyboardEvent): void;
    /**
     * A handler for the autocomplete event when a user suggestion is selected.
     * Adds the user to the pending operations and dispatches `pending-changed`.
     *
     * @param event The custom event from the autocomplete input containing the selected item
     */
    protected handleUserSuggestion(event: CustomEvent<{
        item: HTMLElement;
    }>): void;
    /**
     * A handler for the remove event on a user chip.
     * Removing a user chip puts the user back into the suggestions list.
     *
     * @param e The event triggered by the chip removal
     */
    protected handleChipClose(e: Event): void;
    /**
     * Focuses the input when the container is clicked to ensure a good UX.
     *
     * @param event The mouse event on the container
     */
    protected handleInputContainerClick(event: MouseEvent): void;
    /**
     * Handles the change event of the grant type selector for new shares.
     * Dispatches `grant-changed`.
     *
     * @param e The change event
     */
    protected handleGrantTypeChange(e: Event): void;
    /**
     * Handles changes to the permission role of an existing user.
     * Updates the pending operations and dispatches `pending-changed`.
     *
     * @param e The change event
     */
    protected handleUserRoleChange(e: Event): void;
    protected render(): TemplateResult;
    /**
     * Renders the introductory text based on single or multiple file sharing.
     */
    protected renderIntro(): TemplateResult;
    /**
     * Renders the main input area including chips, text input and grant type selector.
     */
    protected renderInput(): TemplateResult;
    /**
     * Renders the list of user suggestions for autocomplete.
     */
    protected renderUserSuggestions(): TemplateResult | typeof nothing;
    /**
     * Renders a single user suggestion item.
     * @param user The user object to render
     */
    protected renderSuggestion(user: IUser): TemplateResult;
    /**
     * Renders a chip for a selected user.
     * @param user The user object to render
     */
    protected renderChip(user: IUser): TemplateResult;
    /**
     * Renders the grant type selector (Writer/Reader) for new shares.
     */
    protected renderGrantTypeSelector(): TemplateResult | typeof nothing;
    /**
     * Renders the section showing people who already have access.
     */
    protected renderPeopleWithAccess(): TemplateResult | typeof nothing;
    /**
     * Renders a permission item/row for an existing user.
     * @param permission The permission object
     */
    protected renderPermission(permission: IPermission): TemplateResult;
    /**
     * Renders the role selector for an existing permission.
     * @param user The user associated with the permission
     * @param permission The permission object
     */
    protected renderSharedUserOptions(user: IUser, permission: IPermission): TemplateResult;
}
//# sourceMappingURL=ShareFile.d.ts.map