"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getIsAISummaryEnabled = exports.getAISummaryErrorMessage = void 0;
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _constants = require("../constants");
var _messages = require("../messages");
var getIsAISummaryEnabled = exports.getIsAISummaryEnabled = function getIsAISummaryEnabled() {
  var _response$meta;
  var isAdminHubAIEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  var response = arguments.length > 1 ? arguments[1] : undefined;
  return Boolean(isAdminHubAIEnabled && (response === null || response === void 0 || (_response$meta = response.meta) === null || _response$meta === void 0 || (_response$meta = _response$meta.supportedFeature) === null || _response$meta === void 0 ? void 0 : _response$meta.includes('AISummary')));
};
var getAISummaryErrorMessage = exports.getAISummaryErrorMessage = function getAISummaryErrorMessage(error) {
  switch (error) {
    case 'ACCEPTABLE_USE_VIOLATIONS':
      return {
        message: _messages.messages.ai_summary_error_acceptable_use_violation,
        url: _constants.CONTENT_URL_ACCEPTABLE_USE_POLICY
      };
    case 'HIPAA_CONTENT_DETECTED':
      return {
        message: _messages.messages.ai_summary_error_hipaa_content_detected
      };
    case 'EXCEEDING_CONTEXT_LENGTH_ERROR':
      return {
        message: _messages.messages.ai_summary_error_exceeding_context_length_error
      };
    default:
      return {
        message: (0, _platformFeatureFlags.fg)('platform_sl_ai_summary_rebrand') ? _messages.messages.ai_summary_error_generic_rebrand : _messages.messages.ai_summary_error_generic,
        url: _constants.CONTENT_URL_AI_TROUBLESHOOTING
      };
  }
};