import React from 'react';
import AiSearchIcon from '@atlaskit/icon-lab/core/ai-search';
import AiChatIcon from '@atlaskit/icon/core/ai-chat';
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
import { RovoIcon } from '@atlaskit/logo';
import { CardDisplay } from '../../../constants';
import { messages } from '../../../messages';
import AiChapterIcon from '../../FlexibleCard/assets/ai-chapter-icon';
import AISearchIcon from '../../FlexibleCard/assets/ai-search-icon';
import htmlToAdf from '../../FlexibleCard/components/actions/rovo-chat-action/html-to-adf';
export var RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
  RovoChatPromptKey["SUMMARIZE_LINK"] = "summarize-link";
  RovoChatPromptKey["KEY_HIGHLIGHTS"] = "key-highlights";
  RovoChatPromptKey["ASK_ROVO_ANYTHING"] = "ask-rovo-anything";
  RovoChatPromptKey["IDENTIFY_KEY_POINTS"] = "identify-key-points";
  RovoChatPromptKey["IDENTIFY_KEY_TRENDS"] = "identify-key-trends";
  RovoChatPromptKey["FIND_OPEN_QUESTIONS"] = "find-open-questions";
  RovoChatPromptKey["HIGHLIGHT_RELEVANT_CONTENT"] = "highlight-relevant-content";
  RovoChatPromptKey["SUMMARIZE_THIS_FOR_ME"] = "summarize-this-for-me";
  RovoChatPromptKey["ASK_A_SPECIFIC_QUESTION"] = "ask-a-specific-question";
  RovoChatPromptKey["SHOW_ME_WHATS_RELEVANT"] = "show-me-whats-relevant";
  RovoChatPromptKey["SUMMARIZE_DOCUMENT"] = "summarize-document";
  RovoChatPromptKey["SUMMARIZE_PRESENTATION"] = "summarize-presentation";
  RovoChatPromptKey["EXPLAIN_CODE"] = "explain-code";
  RovoChatPromptKey["CATCH_UP"] = "catch-up";
  RovoChatPromptKey["SALESFORCE_PREP"] = "salesforce-prep";
  return RovoChatPromptKey;
}({});
var getContext = function getContext(intl, product) {
  switch (product) {
    case 'CONFLUENCE':
      return {
        contextLong: intl.formatMessage(messages.rovo_prompt_context_confluence_page)
      };
    case 'JSW':
    case 'JWM':
    case 'JSM':
    case 'JPD':
      return {
        contextLong: intl.formatMessage(messages.rovo_prompt_context_jira_work_item)
      };
  }
};
export var getPromptAction = function getPromptAction(_ref) {
  var _getContext;
  var promptKey = _ref.promptKey,
    intl = _ref.intl,
    _ref$url = _ref.url,
    url = _ref$url === void 0 ? '' : _ref$url,
    product = _ref.product,
    iconSize = _ref.iconSize,
    cardAppearance = _ref.cardAppearance,
    provider = _ref.provider;
  var _ref2 = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
      contextLong: intl.formatMessage(messages.rovo_prompt_context_generic)
    },
    contextLong = _ref2.contextLong;
  switch (promptKey) {
    case RovoChatPromptKey.SUMMARIZE_LINK:
      var label_summarize = intl.formatMessage(messages.ai_summarize);
      var html_summarize = intl.formatMessage(messages.rovo_prompt_message_summarize, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChatIcon, {
          label: label_summarize,
          size: iconSize
        }),
        content: label_summarize,
        tooltipMessage: label_summarize,
        data: {
          name: label_summarize,
          dialogues: [],
          prompt: htmlToAdf(html_summarize),
          mode: {
            fastModeEnabled: true
          }
        }
      };
    case RovoChatPromptKey.SUMMARIZE_THIS_FOR_ME:
      var label_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_button_summarize_this);
      var html_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_message_summarize, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_summarize_this_for_me
        }),
        content: label_summarize_this_for_me,
        tooltipMessage: label_summarize_this_for_me,
        data: {
          name: label_summarize_this_for_me,
          dialogues: [],
          prompt: htmlToAdf(html_summarize_this_for_me),
          mode: {
            fastModeEnabled: true
          }
        }
      };
    case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
      var label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
      var html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
        context: contextLong,
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
        content: label_highlight_relevant_content,
        tooltipMessage: label_highlight_relevant_content,
        data: {
          name: label_highlight_relevant_content,
          dialogues: [],
          prompt: htmlToAdf(html_highlight_relevant_content),
          mode: {
            fastModeEnabled: true
          }
        }
      };
    case RovoChatPromptKey.ASK_ROVO_ANYTHING:
      var label_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_button_ask_rovo_anything);
      var prompt_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
        url: url
      });
      return {
        icon: cardAppearance === CardDisplay.Block && !!product && product === 'CONFLUENCE' ? /*#__PURE__*/React.createElement(RovoIcon, {
          label: label_ask_rovo_anything,
          size: 'xxsmall',
          shouldUseHexLogo: true
        }) : /*#__PURE__*/React.createElement(AISearchIcon, null),
        content: label_ask_rovo_anything,
        tooltipMessage: label_ask_rovo_anything,
        data: {
          name: label_ask_rovo_anything,
          dialogues: [],
          prompt: prompt_ask_rovo_anything,
          isPromptPlaceholder: true,
          placeholderType: 'generic'
        }
      };
    case RovoChatPromptKey.ASK_A_SPECIFIC_QUESTION:
      var label_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_button_ask_a_specific_question);
      var prompt_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
        url: url
      });
      return {
        icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
          label: label_ask_a_specific_question
        }),
        content: label_ask_a_specific_question,
        tooltipMessage: label_ask_a_specific_question,
        data: {
          name: label_ask_a_specific_question,
          dialogues: [],
          prompt: prompt_ask_a_specific_question,
          isPromptPlaceholder: true,
          placeholderType: 'generic'
        }
      };
    case RovoChatPromptKey.KEY_HIGHLIGHTS:
      var label_key_highlights = intl.formatMessage(messages.rovo_prompt_button_key_highlights);
      var html_key_highlights = intl.formatMessage(messages.rovo_prompt_message_key_highlights, {
        context: contextLong,
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChatIcon, {
          label: label_key_highlights,
          size: iconSize
        }),
        content: label_key_highlights,
        tooltipMessage: label_key_highlights,
        data: {
          name: label_key_highlights,
          dialogues: [],
          prompt: htmlToAdf(html_key_highlights)
        }
      };
    case RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT:
      var label_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_button_show_me_whats_relevant);
      var html_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
        context: contextLong,
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiSearchIcon, {
          label: label_show_me_whats_relevant
        }),
        content: label_show_me_whats_relevant,
        tooltipMessage: label_show_me_whats_relevant,
        data: {
          name: label_show_me_whats_relevant,
          dialogues: [],
          prompt: htmlToAdf(html_show_me_whats_relevant)
        }
      };
    case RovoChatPromptKey.IDENTIFY_KEY_TRENDS:
      var label_identify_key_trends = intl.formatMessage(messages.rovo_prompt_button_identify_key_trends);
      var html_identify_key_trends = intl.formatMessage(messages.rovo_prompt_message_identify_key_trends, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChatIcon, {
          label: label_identify_key_trends,
          size: iconSize
        }),
        content: label_identify_key_trends,
        tooltipMessage: label_identify_key_trends,
        data: {
          name: label_identify_key_trends,
          dialogues: [],
          prompt: htmlToAdf(html_identify_key_trends)
        }
      };
    case RovoChatPromptKey.IDENTIFY_KEY_POINTS:
      var label_identify_key_points = intl.formatMessage(messages.rovo_prompt_button_identify_key_points);
      var html_identify_key_points = intl.formatMessage(messages.rovo_prompt_message_identify_key_points, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChatIcon, {
          label: label_identify_key_points,
          size: iconSize
        }),
        content: label_identify_key_points,
        tooltipMessage: label_identify_key_points,
        data: {
          name: label_identify_key_points,
          dialogues: [],
          prompt: htmlToAdf(html_identify_key_points)
        }
      };
    case RovoChatPromptKey.FIND_OPEN_QUESTIONS:
      var label_find_open_questions = intl.formatMessage(messages.rovo_prompt_button_find_open_questions);
      var html_find_open_questions = intl.formatMessage(messages.rovo_prompt_message_find_open_questions, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        icon: /*#__PURE__*/React.createElement(AiChatIcon, {
          label: label_find_open_questions,
          size: iconSize
        }),
        content: label_find_open_questions,
        tooltipMessage: label_find_open_questions,
        data: {
          name: label_find_open_questions,
          dialogues: [],
          prompt: htmlToAdf(html_find_open_questions)
        }
      };
    case RovoChatPromptKey.SUMMARIZE_DOCUMENT:
      var label_summarize_document = intl.formatMessage(messages.ai_summarize);
      var html_summarize_document = intl.formatMessage(messages.rovo_prompt_message_summarize_document, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        content: label_summarize_document,
        tooltipMessage: label_summarize_document,
        data: {
          name: label_summarize_document,
          dialogues: [],
          prompt: htmlToAdf(html_summarize_document)
        },
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_summarize_document,
          size: iconSize
        })
      };
    case RovoChatPromptKey.SUMMARIZE_PRESENTATION:
      var label_summarize_presentation = intl.formatMessage(messages.ai_summarize);
      var html_summarize_presentation = intl.formatMessage(messages.rovo_prompt_message_summarize_presentation, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        content: label_summarize_presentation,
        tooltipMessage: label_summarize_presentation,
        data: {
          name: label_summarize_presentation,
          dialogues: [],
          prompt: htmlToAdf(html_summarize_presentation)
        },
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_summarize_presentation,
          size: iconSize
        })
      };
    case RovoChatPromptKey.EXPLAIN_CODE:
      var label_explain_code = intl.formatMessage(messages.rovo_prompt_button_explain_code);
      var html_explain_code = intl.formatMessage(messages.rovo_prompt_message_explain_code, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        content: label_explain_code,
        tooltipMessage: label_explain_code,
        data: {
          name: label_explain_code,
          dialogues: [],
          prompt: htmlToAdf(html_explain_code)
        },
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_explain_code,
          size: iconSize
        })
      };
    case RovoChatPromptKey.CATCH_UP:
      var label_catch_up = intl.formatMessage(messages.rovo_prompt_button_catch_up);
      var html_catch_up = intl.formatMessage(messages.rovo_prompt_message_catch_up, {
        url: url,
        provider: provider
      }, {
        ignoreTag: true
      });
      return {
        content: label_catch_up,
        tooltipMessage: label_catch_up,
        data: {
          name: label_catch_up,
          dialogues: [],
          prompt: htmlToAdf(html_catch_up)
        },
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_catch_up,
          size: iconSize
        })
      };
    case RovoChatPromptKey.SALESFORCE_PREP:
      var label_overview = intl.formatMessage(messages.rovo_prompt_button_salesforce_prep);
      var html_overview = intl.formatMessage(messages.rovo_prompt_message_salesforce_prep, {
        url: url
      }, {
        ignoreTag: true
      });
      return {
        content: label_overview,
        tooltipMessage: label_overview,
        data: {
          name: label_overview,
          dialogues: [],
          prompt: htmlToAdf(html_overview)
        },
        icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
          label: label_overview,
          size: iconSize
        })
      };
  }
};