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

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

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

const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
    RoleSummary: 'RoleSummary',
    RoleBasicData: 'RoleBasicData',
    SubRoles: 'SubRoles',
    InheritedRoles: 'InheritedRoles',
    RoleLog: 'RoleLog',
};
</script>
<template>
    <VnCard
        data-key="Role"
        :descriptor="RoleDescriptor"
        :search-data-key="searchBarDataKeys[routeName]"
        :search-custom-route-redirect="customRouteRedirectName"
        :search-redirect="!!customRouteRedirectName"
        :searchbar-label="t('role.searchRoles')"
        :searchbar-info="t('role.searchInfo')"
    />
</template>
