<script setup>
/**
 * Section header: optional border-bottom (divider) for grouping blocks (e.g. Bedrijf, Adres, Contact).
 * Use default slot for content or title prop for plain text.
 */
import { computed } from "vue";

const props = defineProps({
  /** When true, show a border below the heading. */
  divider: { type: Boolean, default: true },
  /** Heading level (2 or 3). */
  level: { type: Number, default: 3, validator: (v) => [2, 3].includes(v) },
  title: { type: String, default: "" },
});

const tag = computed(() => `h${props.level}`);
const classes = computed(() => {
  const base = "font-medium text-surface-700 dark:text-surface-300";
  const size = props.level === 2 ? "text-xl mb-4" : "text-lg pb-2";
  const border = props.divider
    ? "border-b border-surface-200 dark:border-surface-700"
    : "";
  return [base, size, border].filter(Boolean).join(" ");
});
</script>

<template>
  <component :is="tag" :class="classes">
    <slot>{{ title }}</slot>
  </component>
</template>
