import { getContactSettings } from "@/app/actions/contact";
import ContactClient from "@/components/admin/ContactClient";

export const dynamic = "force-dynamic";

export default async function ContactPage() {
  const result = await getContactSettings();
  
  // result.data will always be populated if success because we upsert "default"
  const settings = result.success && result.data ? result.data : {
    address: "Akyaka, Gökova Körfezi, Muğla",
    phone: "905000000000",
    instagram: "https://www.instagram.com/kozmosbeach/",
    mapUrl: "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d12754.717654763133!2d28.3144!3d36.9507!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14bf76ccf312ba37%3A0xcdaaa97b102b4bb7!2sAkyaka%2C%20Ula%2FMu%C4%9Fla!5e0!3m2!1str!2str!4v1700000000000!5m2!1str!2str"
  };

  return <ContactClient settings={settings as any} />;
}
