<template>
  <div class="analysis-tools-page">
    <CreoModelAnalysis
      v-if="currentConnectedSoftware === 'creo'"
      @show-shell-analysis-result="(data) => $emit('show-shell-analysis-result', data)"
      @show-hierarchy-analysis-result="(data) => $emit('show-hierarchy-analysis-result', data)"
      @show-geometry-complexity-result="(data) => $emit('show-geometry-complexity-result', data)"
      @show-geometry-optimization-params="$emit('show-geometry-optimization-params')"
    />
    <RevitAnalysisDashboard
      v-else-if="currentConnectedSoftware === 'revit'"
      :model-data="modelData"
      @page-change="(page) => $emit('page-change', page)"
    />
    <div v-else-if="currentConnectedSoftware === 'pdms'" class="no-connection">PDMS分析功能开发中</div>
    <div v-else class="no-connection">请先连接CAD软件</div>
  </div>
</template>

<script setup>
import CreoModelAnalysis from '@/components/pages/CreoModelAnalysis.vue'
import RevitAnalysisDashboard from '@/components/pages/RevitAnalysisDashboard.vue'

defineProps({
  currentConnectedSoftware: {
    type: String,
    default: null
  },
  modelData: {
    type: Object,
    default: null
  }
})

defineEmits([
  'show-shell-analysis-result',
  'show-hierarchy-analysis-result',
  'show-geometry-complexity-result',
  'show-geometry-optimization-params',
  'page-change'
])
</script>

<script>
export default {
  name: 'AnalysisToolsPage'
}
</script>

<style scoped>
.analysis-tools-page {
  width: 100%;
  height: 100%;
}

.no-connection {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-secondary);
  font-size: 16px;
  text-align: center;
}
</style>
