<template>
  <a-form-item label="场景名称" required>
    <a-input
      :value="data.name"
      name="radioGroup"
      placeholder="请输入名称最多40字"
      :maxlength="40"
      @update:value="name => $emit('update:data', { ...data, name })"
    />
  </a-form-item>
  <a-form-item label="BIM文件" required>
    <Upload
      :disabled="update"
      :file="data.file"
      :max-size="5 * 1024"
      :extnames="['ifc']"
      @update:file="file => $emit('update:data', { ...data, file })"
    />
  </a-form-item>
</template>

<script setup lang="ts">
import Upload from '@/components/upload/index.vue'
import { BimUploadData } from '@/store'

import type { BUploadProps } from '@/components/upload/index.vue'

export type UploadData = Pick<BUploadProps, 'file'> &
  Omit<BimUploadData, 'file'>

defineOptions<{ name: 'project-bim-upload' }>()

defineProps<{ data: UploadData; update?: boolean }>()
defineEmits<{ (e: 'update:data', value: UploadData): void }>()
</script>
