"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var wizard_type_seeds_exports = {};
__export(wizard_type_seeds_exports, {
  wizardTypeSeeder: () => wizardTypeSeeder
});
module.exports = __toCommonJS(wizard_type_seeds_exports);
var import_client = require("@prisma/sql/client");
const prisma = new import_client.PrismaClient();
const wizardTypes = [
  { id: 1, name: "static", description: "Static" },
  { id: 2, name: "chart", description: "Chart" }
];
async function wizardTypeSeeder(company_id) {
  try {
    console.log("\u{1F680} Starting WizardType Seeder...");
    await prisma.$transaction(async (tx) => {
      for (const wizardType of wizardTypes) {
        const existingWizardType = await tx.wizardType.findUnique({
          where: { id: wizardType.id }
        });
        if (!existingWizardType) {
          await tx.$executeRawUnsafe(`
            SET IDENTITY_INSERT wizard_types ON;
            INSERT INTO wizard_types (id, name, description, company_id) 
            VALUES (${wizardType.id}, '${wizardType.name}', '${wizardType.description}', ${company_id});
            SET IDENTITY_INSERT wizard_types OFF;
          `);
          console.log(`\u2705 Created WizardType with id ${wizardType.id}: ${wizardType.name}`);
        } else {
          console.log(`\u{1F504} WizardType with id ${wizardType.id} already exists.`);
        }
      }
    });
    console.log("\u2705 WizardType seeder completed successfully.");
  } catch (error) {
    console.error(`\u274C Error in wizardTypeSeeder: ${error}`);
    throw error;
  } finally {
    await prisma.$disconnect();
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  wizardTypeSeeder
});
