"use client";
import { useCreateCms } from "@/hooks/queries/useCmsQueries";
import { BreadcrumbItem } from "@/types/shared";
import MarketingForm from "../_components/MarketingForm";

const Marketing = () => {
  const { mutate: createCms, isPending } = useCreateCms();

  const breadcrumbItems: BreadcrumbItem[] = [
    {
      href: "/",
      name: "Dashboard",
    },
    {
      href: "/marketing",
      name: "Marketing",
    },
    {
      href: "/marketing/create",
      name: "Create Marketing",
    },
  ];

  const handleSubmit = (data: any) => {
    createCms(data, {
      onSuccess: () => {
        console.log("CMS created successfully");
      },
      onError: (error) => {
        console.error("Error creating CMS:", error);
      },
    });
  };

  return (
    <MarketingForm
      breadcrumbItems={breadcrumbItems}
      title="Create Marketing page"
      onSubmit={handleSubmit}
      isPending={isPending}
    />
  );
};

export default Marketing;
