import * as tslib_1 from "tslib";
import * as React from 'react';
import { css } from '../../Utilities';
import { Icon } from '../../Icon';
import { PersonaPresence as PersonaPresenceEnum } from './Persona.types';
import * as stylesImport from './Persona.scss';
var styles = stylesImport;
var coinSizeFontScaleFactor = 6;
var coinSizePresenceScaleFactor = 3;
var presenceMaxSize = 40;
var presenceFontMaxSize = 20;
var PersonaPresence = /** @class */ (function (_super) {
    tslib_1.__extends(PersonaPresence, _super);
    function PersonaPresence(props) {
        var _this = _super.call(this, props) || this;
        _this._determineIcon = function () {
            var presence = _this.props.presence;
            if (presence !== PersonaPresenceEnum.none) {
                var userPresence = PersonaPresenceEnum[presence];
                switch (userPresence) {
                    case 'online':
                        userPresence = 'SkypeCheck';
                        break;
                    case 'away':
                        userPresence = 'SkypeClock';
                        break;
                    case 'dnd':
                        userPresence = 'SkypeMinus';
                        break;
                    default:
                        userPresence = '';
                }
                return userPresence;
            }
        };
        return _this;
    }
    PersonaPresence.prototype.render = function () {
        var _a = this.props, presence = _a.presence, coinSize = _a.coinSize;
        var presenceHeightWidth = coinSize && (coinSize / coinSizePresenceScaleFactor < presenceMaxSize ? coinSize / coinSizePresenceScaleFactor : presenceMaxSize);
        var presenceFontSize = coinSize && (coinSize / coinSizeFontScaleFactor < presenceFontMaxSize ? coinSize / coinSizeFontScaleFactor : presenceFontMaxSize);
        var coinSizeWithPresenceIconStyle = coinSize ? { fontSize: presenceFontSize, lineHeight: presenceHeightWidth + 'px' } : undefined;
        var coinSizeWithPresenceStyle = coinSize ? { width: presenceHeightWidth, height: presenceHeightWidth } : undefined;
        if (presence === PersonaPresenceEnum.none) {
            return null;
        }
        return (React.createElement("div", { className: css('ms-Persona-presence', styles.presence), style: coinSizeWithPresenceStyle },
            React.createElement(Icon, { className: css('ms-Persona-presenceIcon', styles.presenceIcon), iconName: this._determineIcon(), style: coinSizeWithPresenceIconStyle })));
    };
    return PersonaPresence;
}(React.Component));
export { PersonaPresence };
//# sourceMappingURL=PersonaPresence.js.map