"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _linkExtractors = require("@atlaskit/link-extractors");
var _constants = require("../../../constants");
/**
 * Computes the relevant icon for a document type.
 *
 * @remark Note that document icons can vary based on the provider. E.g., a
 * provider may choose to re-use one of these document types in their domain,
 * but offer a different SVG icon on the frontend (to map to this type in their
 * domain). See `schema:digitalDocument` for an example of this behaviour. This
 * mechanism will be superseded by backend-driven icon URLs as part of
 * go/j/MODES-5864. Do not add more!
 *
 * @param documentType JSON-LD document type
 * @param label human-readable label to be displayed on the icon
 * @param providerId JSON-LD provider (generator ID)
 * @returns an icon descriptor representing the document type
 */
var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label, providerId) {
  switch (documentType) {
    case 'schema:BlogPosting':
      return {
        icon: _constants.IconType.Blog,
        label: label
      };
    case 'schema:DigitalDocument':
      if (providerId && (0, _linkExtractors.isConfluenceGenerator)(providerId)) {
        return {
          icon: _constants.IconType.LiveDocument,
          label: label
        };
      } else {
        return {
          icon: _constants.IconType.File,
          label: label
        };
      }
    case 'schema:TextDigitalDocument':
      return {
        icon: _constants.IconType.Document,
        label: label
      };
    case 'schema:PresentationDigitalDocument':
      return {
        icon: _constants.IconType.Presentation,
        label: label
      };
    case 'schema:SpreadsheetDigitalDocument':
      return {
        icon: _constants.IconType.Spreadsheet,
        label: label
      };
    case 'atlassian:Template':
      return {
        icon: _constants.IconType.Template,
        label: label
      };
    case 'atlassian:UndefinedLink':
      return {
        icon: _constants.IconType.Document,
        label: label
      };
    default:
      return undefined;
  }
};
var _default = exports.default = extractDocumentTypeIcon;