<script setup lang="ts">
import StatusIndicator from "@/components/StatusIndicator.vue";
import { Card } from "@/components/ui/card";

defineProps<{
    title: string;
    subtitle?: string | null;
    icon?: object | Function;
    status?: string | null;
}>();
</script>

<template>
    <Card class="overflow-hidden">
        <div class="flex items-center justify-between gap-3 border-b bg-muted/30 px-4 py-3">
            <div class="flex min-w-0 items-center gap-2">
                <component :is="icon" v-if="icon" class="size-4 shrink-0 opacity-70" />
                <span class="truncate font-semibold">{{ title }}</span>
                <span v-if="subtitle" class="truncate text-xs text-muted-foreground">{{
                    subtitle
                }}</span>
            </div>
            <StatusIndicator v-if="status" :status="status" />
        </div>
        <div class="grid gap-2.5 p-4">
            <slot />
        </div>
    </Card>
</template>
