import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover';
import GlTruncate from '../../../../../../utilities/truncate/truncate';
import GlIcon from '../../../../../../base/icon/icon';
import { categoryValidator, contextItemValidator, getContextItemSecondaryText, getContextItemIcon, getContextItemSource } from '../utils';
import GlBadge from '../../../../../../base/badge/badge';
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';

/**
 * This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
 *
 * Please use the corresponding component in Duo-UI going forward.
 * All future development and maintenance for Duo components should take place in Duo-UI.
 *
 * For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
 */
var script = {
  name: 'GlDuoChatContextItemMenuSearchItem',
  components: {
    GlBadge,
    GlTruncate,
    GlIcon,
    GlDuoChatContextItemPopover
  },
  props: {
    category: {
      type: Object,
      required: true,
      validator: categoryValidator
    },
    contextItem: {
      type: Object,
      required: true,
      validator: contextItemValidator
    }
  },
  computed: {
    title() {
      var _this$contextItem$met;
      return ((_this$contextItem$met = this.contextItem.metadata) === null || _this$contextItem$met === void 0 ? void 0 : _this$contextItem$met.title) || '';
    },
    secondaryText() {
      return getContextItemSecondaryText(this.contextItem);
    },
    icon() {
      return getContextItemIcon(this.contextItem, this.category);
    },
    itemSource() {
      return getContextItemSource(this.contextItem);
    }
  }
};

/* script */
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.icon,"data-testid":"category-icon"}}),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.title,"data-testid":"item-title"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-ml-2 gl-shrink-0 gl-cursor-pointer gl-text-secondary",attrs:{"id":("info-icon-" + (_vm.contextItem.id)),"name":"information-o","size":12}}),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":_vm.contextItem,"target":("info-icon-" + (_vm.contextItem.id)),"placement":"left"}})],1),_vm._v(" "),(_vm.secondaryText)?_c('div',{staticClass:"gl-align-items-center gl-mt-1 gl-flex gl-shrink-0 gl-whitespace-nowrap gl-text-secondary",attrs:{"data-testid":"item-secondary-text"}},[(_vm.itemSource)?_c('gl-badge',{staticClass:"gl-mr-1",attrs:{"variant":"neutral","data-testid":"context-item-source"}},[_vm._v(_vm._s(_vm.itemSource))]):_vm._e(),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"position":"middle","text":_vm.secondaryText}})],1):_vm._e()])};
var __vue_staticRenderFns__ = [];

  /* style */
  const __vue_inject_styles__ = undefined;
  /* scoped */
  const __vue_scope_id__ = undefined;
  /* module identifier */
  const __vue_module_identifier__ = undefined;
  /* functional template */
  const __vue_is_functional_template__ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__ = __vue_normalize__(
    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
    __vue_inject_styles__,
    __vue_script__,
    __vue_scope_id__,
    __vue_is_functional_template__,
    __vue_module_identifier__,
    false,
    undefined,
    undefined,
    undefined
  );

export default __vue_component__;
