import { getAllServices } from "@/lib/admin-queries";
import { ServiceTable } from "@/components/admin/catalog/ServiceTable";
import { ServiceForm } from "@/components/admin/catalog/ServiceForm";

export const revalidate = 0;

export default async function CatalogPage() {
  const services = await getAllServices();

  return (
    <div>
      <div className="flex items-center justify-between mb-6">
        <h1 className="text-2xl font-bold text-[#1a1a1a]">Catalogo Servizi</h1>
      </div>

      <div className="mb-6">
        <ServiceForm />
      </div>

      {services.length === 0 ? (
        <p className="text-sm text-[#71717a]">
          Nessun servizio nel catalogo. Aggiungi il primo servizio qui sopra.
        </p>
      ) : (
        <ServiceTable services={services} />
      )}
    </div>
  );
}
