import { Logger } from "../common/Logger";
import { EventEmitter } from "events";
import { Core } from "../Core";
import { PresenceLevel, PresenceRainbow } from "../common/models/PresenceRainbow";
import { GenericService } from "./GenericService";
import { Bubble } from "../common/models/Bubble";
import { CalendarManager } from "../common/CalendarManager.js";
import { AutoReplyManager } from "../common/AutoReplyManager.js";
export {};
declare class PresenceService extends GenericService {
    private _settings;
    private _presenceEventHandler;
    private _presenceHandlerToken;
    private manualState;
    private _currentPresence;
    RAINBOW_PRESENCE_ONLINE: PresenceLevel.Online;
    RAINBOW_PRESENCE_DONOTDISTURB: PresenceLevel.Dnd;
    RAINBOW_PRESENCE_AWAY: PresenceLevel.Away;
    RAINBOW_PRESENCE_INVISIBLE: PresenceLevel.Invisible;
    private _bubbles;
    static getClassName(): string;
    getClassName(): string;
    static getAccessorName(): string;
    getAccessorName(): string;
    constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _startConfig: {
        start_up: boolean;
        optional: boolean;
    });
    start(_options: any): Promise<unknown>;
    stop(): Promise<unknown>;
    init(useRestAtStartup: boolean): Promise<void>;
    attachHandlers(): void;
    /**
     * @private
     * @method sendInitialPresence
     * @instance
     * @async
     * @category Presence CONNECTED USER
     * @description
     *  Send the initial presence (online) <br>
     * @return {Promise<ErrorManager.Ok>} A promise containing the result
     */
    sendInitialPresence(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method setPresenceTo
     * @instance
     * @async
     * @category Presence CONNECTED USER
     * @description
     *    Allow to change the presence of the connected user <br>
     *    Only the following values are authorized: 'dnd', 'away', 'invisible' or 'online' <br>
     * @param {String} presence The presence value to set i.e: 'dnd', 'away', 'invisible' ('xa' on server side) or 'online'
     * @return {Promise<any, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result (ErrorManager.getErrorManager().OK in case of success)
     
     */
    setPresenceTo(presence: PresenceLevel): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getUserConnectedPresence
     * @instance
     * @category Presence CONNECTED USER
     * @description
     *      Get user presence status calculated from events. <br>
     */
    getUserConnectedPresence(): PresenceRainbow;
    /**
    * @private
    * @method _setUserPresenceStatus
    * @instance
    * @async
    * @category Presence CONNECTED USER
    * @description
    *      Send user presence status and message to xmpp. <br>
    */
    _setUserPresenceStatus(presenceRainbow: PresenceRainbow): Promise<unknown>;
    /**
     * @private
     * @method _sendPresenceFromConfiguration
     * @instance
     * @async
     * @category Presence CONNECTED USER
     * @description
     *      Send user presence according to user settings presence. <br>
     */
    _sendPresenceFromConfiguration(useRestAtStartup: any): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getMyPresenceInformation
     * @since 2.16.0
     * @instance
     * @category Presence CONNECTED USER
     * @description
     *      Get user's resources presences information from server. <br>
     */
    getMyPresenceInformation(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method setApplyMsTeamsPresenceSettings
     * @instance
     * @async
     * @category Presence CONNECTED USER
     * @description
     *    Allow to activate the exchange of presence of the connected user between rainbow and MS Teams on UI side.<br>
     * @param {boolean} connectTeams=false The boolean to activate or not the feature.
     * @return {Promise<any>}
     */
    setApplyMsTeamsPresenceSettings(connectTeams?: boolean): Promise<unknown>;
    /**
     * @private
     * @method sendInitialAllBubblePresence
     * @instance
     * @async
     * @category Presence Bubbles
     * @param {boolean} webinar=false should option webinar be setted.
     * @param {boolean} acknowledge=true should option acknowledge should be setted.
     * @description
     *      Method called to sen presence to all bubbles <br>
     */
    sendInitialAllBubblePresence(webinar?: boolean, acknowledge?: boolean): Promise<any>;
    /**
     * @private
     * @method sendInitialBubblePresenceSync
     * @instance
     * @async
     * @category Presence Bubbles
     * @param {Bubble} bubble The Bubble
     * @param {number} intervalDelay=7500 The interval between sending presence to a Bubble while it failed. default value is 75000 ms.
     * @description
     *      Method called when receiving an invitation to join a bubble <br>
     */
    sendInitialBubblePresenceSync(bubble: Bubble, intervalDelay?: number): Promise<any>;
    /**
     * @private
     * @method sendInitialBubblePresenceById
     * @instance
     * @async
     * @category Presence Bubbles
     * @param {string} id The Bubble id.
     * @param {number} attempt=0 To log a number of attempt of sending presence to the Bubble. default value is 0.
     * @description
     *      Method called when receiving an invitation to join a bubble <br>
     */
    sendInitialBubblePresenceById(id: string, attempt?: number): Promise<unknown>;
    /**
     * @private
     * @method sendInitialBubblePresence
     * @instance
     * @async
     * @category Presence Bubbles
     * @param {Bubble} bubble The Bubble
     * @param {number} attempt=0 To log a number of attempt of sending presence to the Bubble. default value is 0.
     * @description
     *      Method called when receiving an invitation to join a bubble <br>
    */
    sendInitialBubblePresence(bubble: Bubble, attempt?: number): Promise<unknown>;
    /**
     * @private
     * @method sendInitialBubblePresenceSyncFn
     * @instance
     * @async
     * @category Presence Bubbles
     * @param {Bubble} bubble The Bubble
     * @param {number} intervalDelay=7500 The interval between sending presence to a Bubble while it failed. default value is 75000 ms.
     * @description
     *      Method called when receiving an invitation to join a bubble <br>
     */
    sendInitialBubblePresenceSyncFn(bubble: Bubble, intervalDelay?: number): Promise<any>;
    /**
     * @private
     * @method _onUserSettingsChanged
     * @instance
     * @description
     *      Method called when receiving an update on user settings <br>
     */
    _onUserSettingsChanged(): void;
    /**
     * @private
     * @method _onPresenceChanged
     * @instance
     * @description
     *      Method called when receiving an update on user presence <br>
     */
    _onMyPresenceChanged(user: any): void;
    _onEWSgeteventsReceived(data: any): void;
    _onEWSgetautoreplyReceived(data: any): void;
    /**
     * @public
     * @nodered true
     * @method getCalendarState
     * @instance
     * @category Presence CALENDAR
     * @description
     *    Allow to get the calendar presence of the connected user <br>
     *    return promise with {  <br>
     *    busy: boolean, // Does the connected user is busy ? <br>
     *    status: string, // The status of the connected user (one of "free", "busy" or "out_of_office") <br>
     *    subject: string, // The meeting subject. <br>
     *    since: string, // The meeting since date. <br>
     *    until: string // Date until the current presence is valid <br>
     *    }  <br>
     *    <br>
     *        Note : "applyCalendarPresence" boolean is not return by this api, so you can not know if the presence should be used in general calculated presence. </br>
     * @async
     * @return {Promise<{
     *    busy: boolean,
     *    status: string,
     *    subject: string,
     *    since: string,
     *    until: string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     
     */
    getCalendarState(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getCalendarStates
     * @instance
     * @category Presence CALENDAR
     * @param {Array<string>} users The list of the Rainbow user's references - id or logins (Contact::loginEmail) - to retrieve the calendar presence.
     * @description
     *    Allow to get the calendar presence of severals users <br>
     *    return promise with {
     *    usersIdentifier : { // List of calendar user states. <br>
     *    busy: boolean, // Does the connected user is busy ? <br>
     *    status: string, // The status of the connected user (one of "free", "busy" or "out_of_office") <br>
     *    subject: string, // The meeting subject. <br>
     *    since: string, // The meeting since date. <br>
     *    until: string // Date until the current presence is valid <br>
     *    }  <br>
     *    <br>
     *        Note : "applyCalendarPresence" boolean is not return by this api, so you can not know if the presence should be used in general calculated presence. </br>
     * @async
     * @return {Promise< {
     *    busy: boolean,
     *    status: string,
     *    subject: string,
     *    since: string,
     *    until: string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    getCalendarStates(users?: Array<string>): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method setCalendarRegister
     * @instance
     * @category Presence CALENDAR
     * @param {string} type Calendar type. Default : office365, Authorized values : office365, google
     * @param {boolean} redirect Immediately redirect to login page (OAuth2) or generate an HTML page. Default : false.
     * @param {string} callback Redirect URL to the requesting client.
     * @description
     *    Register a new calendar.<br>
     *    return promise with {
     *    "url" : string // Calendar provider's OAuth URL <br>
     *    } <br>
     * @async
     * @return {Promise<{
     *    "url" : string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    setCalendarRegister(type?: string, redirect?: boolean, callbackUrl?: string): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getCalendarAutomaticReplyStatus
     * @instance
     * @category Presence CALENDAR
     * @param {string} userId The id of user to retrieve the calendar automatic reply status.
     * @description
     *    Allow to retrieve the calendar automatic reply status <br>
     *    return promise with { <br>
     *    enabled : string, //  its status <br>
     *    start : string, // its start date <br>
     *    end : string, // its end date <br>
     *    message_text : string, // its message as plain text <br>
     *    message_thtml : string // its message as html <br>
     *    }  <br>
     *    <br>
     * @async
     * @return {Promise<{
     *    enabled : string,
     *    status : string,
     *    start : string,
     *    end : string,
     *    message_text : string,
     *    message_thtml : string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    getCalendarAutomaticReplyStatus(userId?: string): Promise<unknown>;
    /**
     * @private
     * @method enableCalendar
     * @instance
     * @category Presence CALENDAR
     * @deprecated
     * @description
     *    Allow to enable the calendar. <br>
     *    return promise with { <br>
     *       Status : string // Operation status ("enabled" or "disabled") <br>
     *    }  <br>
     *    <br>
     * @async
     * @return {Promise< {
     *       Status : string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    /**
     * @private
     * @method disableCalendar
     * @instance
     * @category Presence CALENDAR
     * @deprecated
     * @description
     *    Allow to disable the calendar. <br>
     *    return promise with { <br>
     *       Status : string // Operation status ("enabled" or "disabled") <br>
     *    }  <br>
     *    <br>
     * @async
     * @return {Promise< {
     *       Status : string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     
     */
    /**
     * @public
     * @nodered true
     * @method controlCalendarOrIgnoreAnEntry
     * @instance
     * @category Presence CALENDAR
     * @param {boolean} disable disable calendar, true to re-enable
     * @param {string} ignore ignore the current calendar entry, false resumes the entry. Possible values : current, false
     * @description
     *    Enable/disable a calendar sharing or ignore a calendar entry. <br>
     *    return promise with { <br>
     *       Status : string // Operation status ("enabled" or "disabled") <br>
     *    }  <br>
     *    <br>
     * @async
     * @return {Promise< {
     *       Status : string
     *    }, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    controlCalendarOrIgnoreAnEntry(disable?: boolean, ignore?: string): Promise<unknown>;
    /**
    * @public
     * @nodered true
    * @method unregisterCalendar
    * @instance
    * @category Presence CALENDAR
    * @description
    *    Delete a calendar sharing. <br>
    *    return promise with { <br>
    *       Status : string // Operation status ("deleted") <br>
    *    }  <br>
    *    <br>
    * @async
    * @return {Promise< {
    *       Status : string
    *    }, ErrorManager>}
    * @fulfil {ErrorManager} - ErrorManager object depending on the result.
    */
    unregisterCalendar(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method controlMsteamsPresence
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @param {boolean} disable disable presence, true to re-enable
     * @param {string} ignore ignore the current rainbow presence sharing
     * @async
     * @description
     *     Enable/disable a presence sharing or ignore rainbow presence sharing. <br>
     *     When disabled or enabled, a message stanza is sent to the user for multi-devices constraints. <br>
     * @return {Promise<any>}
     */
    controlMsteamsPresence(disable?: boolean, ignore?: string): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getMsteamsPresenceState
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @param {string} userId The Rainbow user id, his jid or the email of his attached Microsoft teams presence. Default value is the current connected user's id
     * @async
     * @description
     *     Get a MS-teams presence state <br>
     * @return {Promise<any>} </br> </br>
     *
     * enabled
     * -------
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | busy | Boolean | presence busy flag. |
     *  | status | String | presence status (one of "chat", "busy" or "dnd") |
     *
     *  disabled
     *  --------
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | status | String | presence sharing is disabled (status = 'disabled') |
     *
     *  subscription_error
     *  ------------------
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | status | String | presence sharing with a expired subscription |
     *
     *  none
     *  ----
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | status | String | presence sharing is not defined (status = 'none') |
     *
     *
     *  */
    getMsteamsPresenceState(userId?: string): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method getMsteamsPresenceStates
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @param {Array<string>} users The Rainbow user references (can be email or id). Default value is an Array with the current connected user's id.
     * @async
     * @description
     *     Get a MS-teams presence states of several users <br>
     * @return {Promise<any>}  </br> </br>
     *
     * enabled
     * -------
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | users | Object\[\] | list of presence user states. |
     *  | busy | Boolean | presence busy flag. |
     *  | status | String | presence status (one of "chat", "busy" or "dnd"). |
     *
     *  others
     *  ------
     *
     *  | Champ | Type | Description |
     *  | --- | --- | --- |
     *  | users | Object\[\] | list of presence user states. |
     *  | status | String | presence status (one of "disabled", "subscription_error", "none"). |
     *
     */
    getMsteamsPresenceStates(users?: Array<string>): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method registerMsteamsPresenceSharing
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @param {boolean} redirect Immediately redirect to login page (OAuth2) or generate an HTML page.
     * @param {string} callback Redirect URL to the requesting client.
     * @async
     * @description
     *     The requesting client get a redirection URL or could be redirected immediately to the provider login page to gather user consent. <br>
     * @return {Promise<any>}  </br> </br>
     *
     * | Champ | Type | Description |
     * | --- | --- | --- |
     * | url | String | Microsoft Teams Presence OAuth URL |
     *
     * */
    registerMsteamsPresenceSharing(redirect?: boolean, callback?: string): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method unregisterMsteamsPresenceSharing
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @async
     * @description
     *     Delete a MS Teams presence sharing. <br>
     *     A message stanza is sent to the user for multi-devices constraints. <br>
     * @return {Promise<any>}  </br> </br>
     *
     * | Champ | Type | Description |
     * | --- | --- | --- |
     * | Status | String | Operation status |
     *
     * */
    unregisterMsteamsPresenceSharing(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method activateMsteamsPresence
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @async
     * @description
     *     activate a MS Teams presence sharing. <br>
     *     A message stanza is sent to the user for multi-devices constraints. <br>
     * @return {Promise<any>}  </br> </br>
     *
     * | Champ | Type | Description |
     * | --- | --- | --- |
     * | Status | String | Operation status |
     *
     * */
    activateMsteamsPresence(): Promise<unknown>;
    /**
     * @public
     * @nodered true
     * @method deactivateMsteamsPresence
     * @since 2.20.0
     * @instance
     * @category Manage Presence MSTeams
     * @async
     * @description
     *     desactivate a MS Teams presence sharing. <br>
     *     A message stanza is sent to the user for multi-devices constraints. <br>
     * @return {Promise<any>}  </br> </br>
     *
     * | Champ | Type | Description |
     * | --- | --- | --- |
     * | Status | String | Operation status |
     *
     * */
    deactivateMsteamsPresence(): Promise<unknown>;
    /**
     * @private
     * @method subscribePresence
     * @instance
     * @category Presence Contact
     * @description
     *    Allows to subscribe presence to a contact. <br>
     * @async
     * @return {Promise< any, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    subscribePresence(to: any): Promise<any>;
    /**
     * @public
     * @method notifyCalendarProvider
     * @instance
     * @category Presence Contact
     * @async
     * @description
     * Allows to subscribe users to EWS using a webhook in Rainbow. </BR>
     * EWS cnx opens an event session for each subscribed user.</BR>
     * EWS cnx notify to Rainbow each new appointment changes.</BR>
     *
     * For each event, a IQ GetEvent request will be sent to retrieve a potential event that will occur in current time frame window.
     * @param {Array<string>} ids The ids specified in field value of body request are the Rainbow user id for which a new calendar event has been created.
     * @param {Object} headers Allow to define specifics headers to the request.
     * @param {boolean} forceNotify Allow to to force the refresh of xmpp status as a comparaison is done between old and new presence status.
     * @return {Promise< any, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    notifyCalendarProvider(ids: Array<string>, headers?: any, forceNotify?: boolean): Promise<unknown>;
    /**
     * @public
     * @method sendResultCalendarEvents
     * @instance
     * @category Presence Contact
     * @async
     * @description
     * Allows to send result of a get events iq request from Rainbow. </BR>
     *
     * Note: To be used when a "rainbow_onEWSgetevents" event is received to send events response.
     *
     * @example
     *
     *   rainbowSDK.events.on("rainbow_onEWSgetevents", (data) => {
     *         _logger.log("debug", "MAIN - (rainbow_onEWSgetevents) - rainbow event received.", data);
     *         let calendarManager = new RainbowSDK.CalendarManager(data.id, data.from, data.email);
     *         calendarManager.addEvent(
     *             {
     *                 "id": "evt-001",
     *                 "subject": "Réunion projet",
     *                 "type": "singleInstance",
     *                 "showAs": "busy",
     *                 startDate: {
     *                     "value": "2025-08-14T09:00:00Z",
     *                     "timezone": "Europe/Paris"
     *                 },
     *                 "endDate": {
     *                     "value": "2025-08-14T10:30:00Z",
     *                     timezone: "Europe/Paris"
     *                 }
     *             });
     *         calendarManager.addEvent(
     *             {
     *                 "id": "evt-002",
     *                 "subject": "Pause café",
     *                 "type": "occurrence",
     *                 "showAs": "free",
     *                 "startDate": {
     *                     "value": "2025-08-14T10:30:00Z"
     *                 },
     *                 "endDate": {
     *                     "value": "2025-08-14T10:45:00Z"
     *                 }
     *             });
     *
     *         rainbowSDK.presence.sendResultCalendarEvents(calendarManager);
     *     });
     *
     * @param {CalendarManager} calendarManager Allow to define the result of a get events iq request from Rainbow.
     * @return {Promise< any, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    sendResultCalendarEvents(calendarManager: CalendarManager): Promise<unknown>;
    /**
     * @public
     * @method sendAutoReplyEvents
     * @instance
     * @category Presence Contact
     * @async
     * @description
     * Allows to send result of a get auto reply events iq request from Rainbow. </BR>
     *
     * Note: To be used when a "rainbow_onEWSgetevents" event is received to send events response.
     *
     * @example
     *
     *     rainbowSDK.events.on("rainbow_onEWSgetautoreply", (data) => {
     *         _logger.log("debug", "MAIN - (rainbow_onEWSgetautoreply) - rainbow event received.", data);
     *
     *         let autoReplyManager = new RainbowSDK.AutoReplyManager({
     *             id: data.id,
     *             to: data.from,
     *             state: "scheduled",
     *             email: data.email,
     *             startDate: { value: "2025-08-20T09:00:00Z", timezone: "Europe/Paris" },
     *             endDate: { value: "2025-08-25T18:00:00Z", timezone: "Europe/Paris" },
     *             internalReplyMessage: "Je suis absent du bureau, merci de contacter mon collègue.",
     *             externalReplyMessage: {
     *                 value: "Je suis actuellement en congés.",
     *                 audience: "known"
     *             }
     *         });
     *
     *         rainbowSDK.presence.sendAutoReplyEvents(autoReplyManager);
     *     });
     * @param {AutoReplyManager} autoReplyManager Allow to define  get auto reply events iq.
     * @return {Promise< any, ErrorManager>}
     * @fulfil {ErrorManager} - ErrorManager object depending on the result.
     */
    sendAutoReplyEvents(autoReplyManager: AutoReplyManager): Promise<unknown>;
}
export { PresenceService };
