<script lang="ts" setup>
import { ref } from 'vue';

import { useUserStore } from '@vben/stores';

import BuyerIndex from './buyer-index.vue';
import SellerIndex from './seller-index.vue';

const userStore = useUserStore();

const userType = ref('buyer');
const userTypeMap = {
  buyer: BuyerIndex,
  seller: SellerIndex,
};
</script>

<template>
  <Page auto-content-height>
    <div class="h-full p-3">
      <el-radio-group v-model="userType" class="mb-4">
        <el-radio-button value="buyer">购机者</el-radio-button>
        <el-radio-button value="seller" :disabled="userStore.isDLSNotAdmin">
          经销商
        </el-radio-button>
      </el-radio-group>

      <component
        :is="userTypeMap[userType as keyof typeof userTypeMap]"
        class="flex-1"
      />
    </div>
  </Page>
</template>
