<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';

import VnCard from 'components/common/VnCard.vue';
import AccountDescriptor from './AccountDescriptor.vue';

const { t } = useI18n();
const route = useRoute();

const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
    AccountSummary: 'AccountSummary',
    AccountInheritedRoles: 'AccountInheritedRoles',
    AccountMailForwarding: 'AccountMailForwarding',
    AccountMailAlias: 'AccountMailAlias',
    AccountPrivileges: 'AccountPrivileges',
    AccountLog: 'AccountLog',
};
</script>

<template>
    <VnCard
        data-key="Account"
        :descriptor="AccountDescriptor"
        :search-data-key="searchBarDataKeys[routeName]"
        :search-custom-route-redirect="customRouteRedirectName"
        :search-redirect="!!customRouteRedirectName"
        :searchbar-label="t('account.search')"
        :searchbar-info="t('account.searchInfo')"
    />
</template>
