"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PresenceRainbow = exports.PresencePhone = exports.PresenceDetails = exports.PresenceStatus = exports.PresenceShow = exports.PresenceLevel = exports.PresenceInfo = exports.PresenceCalendar = void 0;
/**
 *   Enum with all presence levels possible
 * @public
 * @enum {string}
 * @readonly
 */
var PresenceLevel;
(function (PresenceLevel) {
    /** Offline/Invisible The presence of the contact is not connected */
    PresenceLevel["Offline"] = "offline";
    /** Offline/Invisible The presence of the contact is not connected */
    PresenceLevel["Invisible"] = "invisible";
    /** The presence of the contact is connected */
    PresenceLevel["Online"] = "online";
    /** The presence of the contact is connected on mobile */
    PresenceLevel["OnlineMobile"] = "online-mobile";
    /** The presence of the contact is connected but away from a long time */
    PresenceLevel["Away"] = "away";
    /** The presence of the contact is in "Do not disturb" state */
    PresenceLevel["Dnd"] = "dnd";
    /** The presence of the contact is in "Busy" state */
    PresenceLevel["Busy"] = "busy";
    /** The presence of the contact appear offline but to stay still connected. */
    PresenceLevel["Xa"] = "xa";
    /** The presence of the contact is not known */
    PresenceLevel["Unknown"] = "Unknown";
    /// internal
    /** internal */
    PresenceLevel["Chat"] = "chat";
    /** The presence of the contact is an empty string */
    PresenceLevel["EmptyString"] = "";
})(PresenceLevel || (exports.PresenceLevel = PresenceLevel = {}));
/**
 *   Enum with all presence Show possible
 * @public
 * @enum {string}
 * @readonly
 */
var PresenceShow;
(function (PresenceShow) {
    /** The presence of the contact is connected */
    PresenceShow["Online"] = "online";
    /** The presence of the contact is disconnected */
    PresenceShow["Offline"] = "offline";
    /** The contact is in "Do not disturb" state */
    PresenceShow["Dnd"] = "dnd";
    /** For current contact only - to appear offline but to stay still connected */
    PresenceShow["Xa"] = "xa";
    /** The contact is away */
    PresenceShow["Away"] = "away";
    /** The Show is Chat */
    PresenceShow["Chat"] = "chat";
    /** The Show is empty string */
    PresenceShow["EmptyString"] = "";
})(PresenceShow || (exports.PresenceShow = PresenceShow = {}));
/**
 *   Enum with all presence Status possible
 * @public
 * @enum {string}
 * @readonly
 */
var PresenceStatus;
(function (PresenceStatus) {
    /** The presence of the contact is connected */
    PresenceStatus["Online"] = "online";
    /** The presence of the contact is disconnected */
    PresenceStatus["ModeAuto"] = "mode=auto";
    /** The contact is connected but away from a long time */
    PresenceStatus["Away"] = "away";
    /** The contact is on phone */
    PresenceStatus["Phone"] = "phone";
    /** The contact is in an appointment - used only in Presence Calendar context */
    PresenceStatus["Appointment"] = "appointment";
    /** The contact is on presentation */
    PresenceStatus["Presentation"] = "presentation";
    /** The contact is on mobile phone */
    PresenceStatus["Mobile"] = "mobile";
    /** The is Teams presence */
    PresenceStatus["Calendar"] = "calendar";
    /** The is Teams presence */
    PresenceStatus["Teams"] = "teams";
    /** The status is empty string. */
    PresenceStatus["EmptyString"] = "";
})(PresenceStatus || (exports.PresenceStatus = PresenceStatus = {}));
// NOT USED YET. It looks to be the same as PresenceStatus
/// To store all presence details possible
var PresenceDetails;
(function (PresenceDetails) {
    /// The contact is inactive - it's presence level is set to Away
    PresenceDetails["Inactive"] = "inactive";
    /// The contact is in audio only conversation - it's presence level is set to Busy
    PresenceDetails["Audio"] = "audio";
    /// The contact is in audio and video conversation - it's presence level is set to Busy
    PresenceDetails["Video"] = "video";
    /// The contact is seeing a sharing  - it's presence level is set to Busy
    PresenceDetails["Sharing"] = "sharing";
    /// The contact is doing a presentation - it's presence level is set to DND
    PresenceDetails["Presentation"] = "presentation";
    /// The contact is busy - used only in Presence Calendar context
    PresenceDetails["Busy"] = "busy";
    /// The contact is "out of office" - used only in Presence Calendar contetx
    PresenceDetails["OutOfOffice"] = "out_of_office";
    /// The contact is free (He is not in a meeting) - used only in Presence Calendar contetx
    PresenceDetails["Free"] = "free";
    PresenceDetails["EmptyString"] = "";
})(PresenceDetails || (exports.PresenceDetails = PresenceDetails = {}));
/**
 *   Enum with the phone presence (linked to PBX)
 * @public
 * @enum {string}
 * @readonly
 */
var PresencePhone;
(function (PresencePhone) {
    /** The PBX service is available - the phone is not currently used */
    PresencePhone["EVT_CONNECTION_CLEARED"] = "EVT_CONNECTION_CLEARED";
    /** The PBX service is available - there is a incoming or outgoing call in ringing state */
    PresencePhone["EVT_SERVICE_INITIATED"] = "EVT_SERVICE_INITIATED";
    /** The PBX service is available - there is a current call */
    PresencePhone["EVT_ESTABLISHED"] = "EVT_ESTABLISHED";
    /** The PBX service is not available / operational so we don't know the presence phone */
    PresencePhone["NOT_AVAILABLE"] = "NOT_AVAILABLE";
})(PresencePhone || (exports.PresencePhone = PresencePhone = {}));
/**
 * @public
 * @class
 * @name PresenceInfo
 * @description
 *   Define the base of each presence - Presence Level and Presence Details
 */
class PresenceInfo {
    get presenceShow() {
        return this._presenceShow;
    }
    set presenceShow(value) {
        this._presenceShow = value;
    }
    /// Constructor with presence level and details
    /// <param name="presenceLevel"><see cref="String"/>The presence level - see <see cref="Model.PresenceLevel"/> for all possible values</param>
    /// <param name="presenceDetails"><see cref="String"/>The presence details - see <see cref="Model.PresenceDetails"/> for all possible values</param>
    constructor(presenceLevel = PresenceLevel.Online, presenceDetails = PresenceDetails.EmptyString) {
        let that = this;
        that._presenceLevel = "";
        that._presenceShow = "";
        that._presenceStatus = "";
        that.presenceLevel = presenceLevel;
        that.presenceDetails = presenceDetails;
    }
    get presenceLevel() {
        return this._presenceLevel;
    }
    set presenceLevel(value) {
        let that = this;
        switch (value) {
            case PresenceLevel.Online:
                //show = "online";
                //status = "";
                /*show = undefined;
                status = "mode=auto";
                // */
                that.presenceShow = PresenceShow.EmptyString;
                that.presenceStatus = PresenceStatus.ModeAuto;
                break;
            case PresenceLevel.Busy:
                /* show = "xa";
                status = "away";
                // */
                value = PresenceLevel.Dnd;
                that.presenceShow = PresenceShow.Dnd;
                that.presenceStatus = PresenceStatus.EmptyString;
                break;
            case PresenceLevel.Away:
                /* show = "xa";
                status = "away";
                // */
                that.presenceShow = PresenceShow.Xa;
                that.presenceStatus = PresenceStatus.Away;
                break;
            case PresenceLevel.Xa:
                /* show = "xa";
                status = "away";
                // */
                value = PresenceLevel.Away;
                that.presenceShow = PresenceShow.Xa;
                that.presenceStatus = PresenceStatus.Away;
                break;
            case PresenceLevel.Dnd:
                /*show = "dnd";
                status = "";
                // */
                that.presenceShow = PresenceShow.Dnd;
                that.presenceStatus = PresenceStatus.EmptyString;
                break;
            case PresenceLevel.Invisible:
                /* show = "xa";
                status = "";
                // */
                that.presenceShow = PresenceShow.Xa;
                that.presenceStatus = PresenceStatus.EmptyString;
                break;
            case PresenceLevel.Offline:
                /* show = "xa";
                status = "";
                // */
                //value = PresenceLevel.Invisible;
                that.presenceShow = PresenceShow.Offline;
                that.presenceStatus = PresenceStatus.EmptyString;
                break;
            default:
                that.presenceShow = PresenceShow.EmptyString;
                that.presenceStatus = PresenceStatus.EmptyString;
                break;
        }
        that._presenceLevel = value;
    }
    get presenceDetails() {
        return this._presenceDetails;
    }
    set presenceDetails(value) {
        this._presenceDetails = value;
    }
    get presenceStatus() {
        return this._presenceStatus;
    }
    set presenceStatus(value) {
        this._presenceStatus = value;
    }
    toJsonForServer() {
        let jsonForServer;
        jsonForServer = {
            show: this._presenceShow,
            status: this._presenceStatus
        };
        return jsonForServer;
    }
}
exports.PresenceInfo = PresenceInfo;
/// To define the calendar presence. Inherit of <see cref="Model.PresenceInfo"/>
class PresenceCalendar extends PresenceInfo {
    /// Constructor with presence level , details and until
    /// <param name="presenceLevel"><see cref="String"/>The presence level - see <see cref="Model.PresenceLevel"/> for all possible values</param>
    /// <param name="presenceDetails"><see cref="String"/>The presence details - see <see cref="Model.PresenceDetails"/> for all possible values</param>
    /// <param name="until"><see cref="DateTime"/>The availability of this presence status - Used only if calendar context</param>
    constructor(presenceLevel, presenceStatus, presenceDetails, until) {
        super(presenceLevel, presenceDetails);
        let that = this;
        that._until = until;
    }
    get until() {
        return this._until;
    }
    set until(value) {
        this._until = value;
    }
}
exports.PresenceCalendar = PresenceCalendar;
/// <summary>
/// To define the contact's presence
/// Inherit of <see cref="PresenceInfo"/>
/// There is 3 context: Calendar presence, Phone presence (linked to PBX) and the IM presence
/// </summary>
/**
 * @public
 * @class
 * @name PresenceRainbow
 * @description
 *   Represent a contact's presence
 */
class PresenceRainbow extends PresenceInfo {
    /// Constructor with resource, presence level and presence details
    /// <param name="resource"><see cref="String"/>The resource linked to this presence level</param>
    /// <param name="date"><see cref="String"/>The date of this presence level</param>
    /// <param name="presenceLevel"><see cref="String"/>The presence level - see <see cref="Model.PresenceLevel"/> for all possible values</param>
    /// <param name="presenceDetails"><see cref="String"/>The presence details - see <see cref="Model.PresenceDetails"/> for all possible values</param>
    constructor(presenceLevel, presenceStatus, presenceDetails, resource, date) {
        super(presenceLevel, presenceDetails);
        let that = this;
        that._date = date;
        that._resource = resource;
        // that._presencePhone = PresencePhone.NOT_AVAILABLE;
        // that._presenceCalendar = new PresenceCalendar(PresenceLevel.Online);
    }
    /*  get presenceCalendar(): PresenceCalendar {
          return this._presenceCalendar;
      }
  
      set presenceCalendar(value: PresenceCalendar) {
          this._presenceCalendar = value;
      }
  
      get presencePhone(): PresencePhone {
          return this._presencePhone;
      }
  
      set presencePhone(value: PresencePhone) {
          this._presencePhone = value;
      }
  */
    get resource() {
        return this._resource;
    }
    set resource(value) {
        this._resource = value;
    }
    get date() {
        return this._date;
    }
    set date(value) {
        this._date = value;
    }
}
exports.PresenceRainbow = PresenceRainbow;
module.exports.PresenceCalendar = PresenceCalendar;
module.exports.PresenceInfo = PresenceInfo;
module.exports.PresenceLevel = PresenceLevel;
module.exports.PresenceShow = PresenceShow;
module.exports.PresenceStatus = PresenceStatus;
module.exports.PresenceDetails = PresenceDetails;
module.exports.PresencePhone = PresencePhone;
module.exports.PresenceRainbow = PresenceRainbow;
//# sourceMappingURL=PresenceRainbow.js.map