const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();

async function main() {
  // First, delete any existing SEO metadata
  await prisma.seometadata.deleteMany({});

  // Create SEO metadata for each page type
  await prisma.seometadata.createMany({
    data: [
      {
        pageType: "PROJECT",
        title: "Project SEO",
        metaDescription: "SEO for projects",
        keywords: "project, portfolio, work",
        ogTitle: "Project OG Title",
        ogDescription: "Project OG Description",
        ogImage: "",
        twitterCard: "",
        canonicalUrl: "",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
      {
        pageType: "HOME",
        title: "Nitescape - Digital Solutions Partner",
        metaDescription: "Welcome to Nitescape - Your Digital Solutions Partner",
        keywords: "digital solutions, web development, software development, IT services",
        ogTitle: "Nitescape - Digital Solutions Partner",
        ogDescription: "Welcome to Nitescape - Your Digital Solutions Partner",
        ogImage: "/images/og-image.jpg",
        twitterCard: "Nitescape - Digital Solutions Partner",
        canonicalUrl: "https://nitescape.com",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
      {
        pageType: "ABOUT",
        title: "About SEO",
        metaDescription: "SEO for about page",
        keywords: "about, company, info",
        ogTitle: "About OG Title",
        ogDescription: "About OG Description",
        ogImage: "",
        twitterCard: "",
        canonicalUrl: "",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
      {
        pageType: "SERVICE",
        title: "Service SEO",
        metaDescription: "SEO for services",
        keywords: "services, offerings",
        ogTitle: "Service OG Title",
        ogDescription: "Service OG Description",
        ogImage: "",
        twitterCard: "",
        canonicalUrl: "",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
      {
        pageType: "BOLD",
        title: "Bold SEO",
        metaDescription: "SEO for bold products",
        keywords: "bold, products",
        ogTitle: "Bold OG Title",
        ogDescription: "Bold OG Description",
        ogImage: "",
        twitterCard: "",
        canonicalUrl: "",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
      {
        pageType: "CONTACT",
        title: "Contact SEO",
        metaDescription: "SEO for contact page",
        keywords: "contact, email, phone",
        ogTitle: "Contact OG Title",
        ogDescription: "Contact OG Description",
        ogImage: "",
        twitterCard: "",
        canonicalUrl: "",
        structuredData: {},
        robotsMeta: "index,follow",
        createdAt: new Date(),
        updatedAt: new Date(),
      },
    ],
  });

  console.log("Database has been seeded. 🌱");
}

main()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
