<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';

const props = defineProps({
    id: {
        type: Number,
        required: false,
        default: null,
    },
});

const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => props.id || route.params.id);
const { store } = useArrayData('Parking');
const card = computed(() => store.data);
</script>
<template>
    <CardDescriptor
        module="Agency"
        data-key="Agency"
        :url="`Agencies/${entityId}`"
        :title="card?.name"
        :subtitle="props.id"
    >
        <template #body="{ entity: agency }">
            <VnLv :label="t('globals.name')" :value="agency.name" />
        </template>
    </CardDescriptor>
</template>
