// @ts-nocheck
import { ServerConnectionState } from '../../utils/enums';
import { EditorAccessTimer, FetchLiveStateDataRequest, LiveStateDataConfig, LiveStateSingleEditorExternalUserPresence, SetLiveStateDataConfig, SetUserAsEditorResponse, SingleEditorConfig, UserEditorAccess } from '../data/live-state-data.data.model';
import { LiveStateEventTypesMap } from '../data/live-state-events.data.model';
import { User } from '../data/user.data.model';

/**
 * Represents the synchronization element for live state.
 */
export declare class LiveStateSyncElement {

    /**
     * Gets live state data based on the provided ID.
     */
    getLiveStateData: <T = unknown>(liveStateDataId?: string, liveStateDataConfig?: LiveStateDataConfig) => Observable<T>;

    /**
     * Gets live state data as an observable based on the provided ID.
     * @deprecated Use `getLiveStateData` instead
     */
    getLiveStateData$: <T = unknown>(liveStateDataId?: string, liveStateDataConfig?: LiveStateDataConfig) => Observable<T>;

    /**
     * Fetches live state data.
     */
    fetchLiveStateData: <T = unknown>(request?: FetchLiveStateDataRequest) => Promise<T>;

    /**
     * Sets live state data for the provided ID and data.
     */
    setLiveStateData: <T = unknown>(liveStateDataId: string, liveStateData: T, config?: SetLiveStateDataConfig) => Promise<void>;

    /**
     * Enables the single editor mode.
     */
    enableSingleEditorMode: (config?: SingleEditorConfig) => void;

    /**
     * Disables the single editor mode.
     */
    disableSingleEditorMode: () => void;

    /**
     * Checks if the current user is an editor. Returns an observable.
     * @deprecated Use `isUserEditor` instead
     */
    isUserEditor$: () => Observable<UserEditorAccess | null | undefined>;

    /**
     * Checks if the current user is an editor. Returns an observable.
     */
    isUserEditor: () => Observable<UserEditorAccess | null | undefined>;

    /**
     * To get editor
     */
    getEditor: () => Observable<User | null>;

    /**
     * Sets the current user as an editor.
     */
    setUserAsEditor: () => Promise<SetUserAsEditorResponse | void>;

    /**
     * Resets the user access.
     */
    resetUserAccess: () => void;

    /**
     * To disable elements inside specific elements only when single editor mode is on
     * @param elementIds Element ids
     */
    singleEditorModeContainerIds: (elementIds: string[]) => void;

    /**
     * To enable auto sync state
     */
    enableAutoSyncState: () => void;
    /**
     * To disable auto sync state
     */
    disableAutoSyncState: () => void;

    /**
     * To request editor access
     */
    requestEditorAccess: () => Observable<boolean | null>;

    /**
     * To check if editor access is requested
     */
    isEditorAccessRequested: () => Observable<{ requestStatus: string, requestedBy: User } | null>;

    /**
     * To accept editor access request
     */
    acceptEditorAccessRequest: () => void;

    /**
     * To reject editor access request
     */
    rejectEditorAccessRequest: () => void;

    /**
     * To cancel editor access request
     */
    cancelEditorAccessRequest: () => void;

    /**
     * To edit current tab
     */
    editCurrentTab: () => void;

    /**
     * To set editor access timeout
     */
    setEditorAccessTimeout: (timeout: number) => void;

    /**
     * To enable editor access transfer on timeout
     */
    enableEditorAccessTransferOnTimeOut: () => void;

    /**
     * To disable editor access transfer on timeout
     */
    disableEditorAccessTransferOnTimeOut: () => void;

    /**
     * To enable default single editor UI
     */
    enableDefaultSingleEditorUI: () => void;

    /**
     * To disable default single editor UI
     */
    disableDefaultSingleEditorUI: () => void;

    /**
     * To get editor access timer
     */
    getEditorAccessTimer: () => Observable<EditorAccessTimer>;

    /**
     * To get server connection state
     * @returns Observable<ServerConnectionState>
     */
    onServerConnectionStateChange: () => Observable<ServerConnectionState>;

    /**
     * To update user presence for single editor mode
     */
    updateUserPresence: (userPresence: LiveStateSingleEditorExternalUserPresence) => void;

    /**
     * To enable heartbeat
     */
    enableHeartbeat: () => void;

    /**
     * To disable heartbeat
     */
    disableHeartbeat: () => void;

    /**
     * Subscribe to live state events
     */
    on: <T extends keyof LiveStateEventTypesMap>(action: T) => Observable<LiveStateEventTypesMap[T]>;

    /**
     * Constructor for LiveStateSyncElement.
     */
    constructor();

    /**
     * Private method for getting live state data as an observable.
     */
    private _getLiveStateData;

    /**
     * Private method for getting live state data as an observable.
     * @deprecated Use `_getLiveStateData` instead
     */
    private _getLiveStateData$;

    /**
     * Private method for fetching live state data.
     */
    private _fetchLiveStateData;

    /**
     * Private method for setting live state data.
     */
    private _setLiveStateData;

    /**
     * Private method to enable single editor mode.
     */
    private _enableSingleEditorMode;

    /**
     * Private method to disable single editor mode.
     */
    private _disableSingleEditorMode;

    /**
     * Private method to check if the user is an editor.
     * @deprecated Use `_isUserEditor` instead
     */
    private _isUserEditor$;

    /**
     * Private method to check if the user is an editor.
     */
    private _isUserEditor;

    /**
     * Private method to get editor.
     */
    private _getEditor;

    /**
     * Private method to set user as an editor.
     */
    private _setUserAsEditor;

    /**
     * Private method to reset user access.
     */
    private _resetUserAccess;

    /**
     * To disable elements inside specific elements only when single editor mode is on
     * @param elementIds Element ids
     */
    private _singleEditorModeContainerIds;

    /**
     * To enable auto sync state
     */
    private _enableAutoSyncState;

    /**
     * To disable auto sync state
     */
    private _disableAutoSyncState;

    /**
     * To request editor access
     */
    private _requestEditorAccess;

    /**
     * To check if editor access is requested
     */
    private _isEditorAccessRequested;

    /**
     * To accept editor access request
     */
    private _acceptEditorAccessRequest;

    /**
     * To reject editor access request
     */
    private _rejectEditorAccessRequest;

    /**
     * To cancel editor access request
     */
    private _cancelEditorAccessRequest;

    /**
     * To edit current tab
     */
    private _editCurrentTab;

    /**
     * To set editor access timeout
     */
    private _setEditorAccessTimeout;

    /**
     * To enable editor access transfer on timeout
     */
    private _enableEditorAccessTransferOnTimeOut;

    /**
     * To disable editor access transfer on timeout
     */
    private _disableEditorAccessTransferOnTimeOut;

    /**
     * To enable default single editor UI
     */
    private _enableDefaultSingleEditorUI;

    /**
     * To disable default single editor UI
     */
    private _disableDefaultSingleEditorUI;

    /**
     * To get editor access timer
     */
    private _getEditorAccessTimer;

    /**
     * To get server connection state
     */
    private _onServerConnectionStateChange;

    /**
     * To update user presence for single editor mode
     */
    private _updateUserPresence;

    /**
     * To enable heartbeat
     */
    private _enableHeartbeat;

    /**
     * To disable heartbeat
     */
    private _disableHeartbeat;

    /**
     * Subscribe to live state events
     */
    private _on;
}
