<template>
  <component :is="kw[workflow_mode]" :show="show" :id="id" :workflow-ref="workflowRef"></component>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { WorkflowMode } from '@/enums/application'
import ApplicationDropdownMenu from '@/components/workflow-dropdown-menu/application/index.vue'
import KnowledgeDropdownMenu from '@/components/workflow-dropdown-menu/knowledge/index.vue'
import KnowledgeDropdownInnerMenu from '@/components/workflow-dropdown-menu/knowledge-inner/index.vue'
import ToolDropdownMenu from '@/components/workflow-dropdown-menu/tool/index.vue'
const workflow_mode: WorkflowMode = inject('workflowMode') || WorkflowMode.Application
const props = defineProps({
  show: {
    type: Boolean,
    default: false,
  },
  id: {
    type: String,
    default: '',
  },
  workflowRef: Object,
  inner: {
    type: Boolean,
    default: false,
  },
})
const kw: any = {
  [WorkflowMode.Application]: ApplicationDropdownMenu,
  [WorkflowMode.ApplicationLoop]: ApplicationDropdownMenu,
  [WorkflowMode.Knowledge]: props.inner ? KnowledgeDropdownInnerMenu : KnowledgeDropdownMenu,
  [WorkflowMode.KnowledgeLoop]: props.inner ? KnowledgeDropdownInnerMenu : KnowledgeDropdownMenu,
  [WorkflowMode.Tool]: ToolDropdownMenu,
  [WorkflowMode.ToolLoop]: ToolDropdownMenu,
}
</script>
<style lang="scss">
@use './index.scss';
</style>
