<script setup>
import { defineEmits, defineProps } from 'vue';

import ChatHeader from './ChatHeader.vue';
import MessageInput from './MessageInput.vue';
import MessageList from './MessageList.vue';

// 定义 props 和 emits
const props = defineProps({
  // ... existing props
});

const emit = defineEmits([
  // ... existing emits
  'openPrescription',
  'end-consultation-success',
  'transfer-import-success',
]);

// 开方功能触发函数
const handleOpenPrescription = (registerId) => {
  emit('openPrescription', registerId);
};

// 结束接诊成功处理函数
const handleEndConsultationSuccess = () => {
  emit('end-consultation-success');
};

// ... rest of the component
</script>

<template>
  <div class="flex h-full flex-col">
    <!-- 聊天头部 -->
    <ChatHeader />

    <!-- 消息区域 -->
    <MessageList 
      class="flex-1"
      @open-prescription="handleOpenPrescription"
      @transfer-import-success="(data) => emit('transfer-import-success', data)"
    />

    <!-- 输入区域 -->
    <MessageInput 
      @open-prescription="handleOpenPrescription" 
      @end-consultation-success="handleEndConsultationSuccess"
      @transfer-import-success="(data) => emit('transfer-import-success', data)"
    />
  </div>
</template>
