import { FcrIcon } from '../icon';
import { FcrMicrophoneIndicator } from '../icon/mic';
import { FcrIconType } from '../icon/type';
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
export var MicrophoneStateMobile = function MicrophoneStateMobile(_ref) {
  var isMicrophoneMuted = _ref.isMicrophoneMuted,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? 20 : _ref$size,
    _ref$voicePercent = _ref.voicePercent,
    voicePercent = _ref$voicePercent === void 0 ? 0 : _ref$voicePercent,
    _ref$isPhoneMic = _ref.isPhoneMic,
    isPhoneMic = _ref$isPhoneMic === void 0 ? false : _ref$isPhoneMic;
  var mutedColor = 'var(--fcr_ui_scene_white10)';
  var activeColor = 'var(--fcr_ui_scene_white10)';
  var renderIcon = function renderIcon(type, iconPrimary) {
    return /*#__PURE__*/_jsx(FcrIcon, {
      size: size,
      type: type,
      colors: {
        iconPrimary: iconPrimary
      }
    });
  };
  if (isPhoneMic) {
    var iconType = FcrIconType.FCR_PHONECALL3; // Default to the highest level
    if (isMicrophoneMuted) {
      iconType = FcrIconType.FCR_PHONECALL_SILENCE;
    } else if (voicePercent >= 20) {
      iconType = FcrIconType.FCR_PHONECALL3;
    } else if (voicePercent >= 10) {
      iconType = FcrIconType.FCR_PHONECALL2;
    } else if (voicePercent >= 5) {
      iconType = FcrIconType.FCR_PHONECALL1;
    }
    return renderIcon(iconType, isMicrophoneMuted ? mutedColor : activeColor);
  }
  return /*#__PURE__*/_jsx(_Fragment, {
    children: isMicrophoneMuted ? renderIcon(FcrIconType.FCR_NOMUTE, mutedColor) : /*#__PURE__*/_jsx(FcrMicrophoneIndicator, {
      voicePercent: voicePercent,
      size: size
    })
  });
};