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

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

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

const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
    return routeName.value;
});
const searchBarDataKeys = {
    AliasBasicData: 'AliasBasicData',
    AliasUsers: 'AliasUsers',
};
</script>

<template>
    <VnCard
        data-key="Alias"
        base-url="MailAliases"
        :descriptor="AliasDescriptor"
        :search-data-key="searchBarDataKeys[routeName]"
        :search-custom-route-redirect="customRouteRedirectName"
        :search-redirect="!!customRouteRedirectName"
        :searchbar-label="t('mailAlias.search')"
        :searchbar-info="t('mailAlias.searchInfo')"
    />
</template>
