<script setup>
import OrganizationChart from "primevue/organizationchart";

const props = defineProps({
  value: {
    type: [Object, Array, null],
    default: null,
  },
});

defineOptions({
  inheritAttrs: false,
});
</script>

<template>
  <OrganizationChart
    v-if="
      (Array.isArray(props.value) && props.value.length) ||
      (props.value &&
        typeof props.value === 'object' &&
        !Array.isArray(props.value))
    "
    :value="props.value"
    v-bind="$attrs"
  >
    <template #default="slotProps">
      <slot name="default" v-bind="slotProps">
        <slot name="node" v-bind="slotProps" />
      </slot>
    </template>
  </OrganizationChart>
</template>
