"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 action_type_seeds_exports = {};
__export(action_type_seeds_exports, {
  actionTypeSeeder: () => actionTypeSeeder
});
module.exports = __toCommonJS(action_type_seeds_exports);
var import_client = require("@prisma/pg/client");
const prisma = new import_client.PrismaClient();
const actionTypes = [
  { id: 1, name: "view", description: "view" },
  { id: 2, name: "add", description: "add" },
  { id: 3, name: "edit", description: "edit" },
  { id: 4, name: "delete", description: "delete" },
  { id: 5, name: "details", description: "details" },
  { id: 6, name: "export_excel", description: "export_excel" },
  { id: 7, name: "import", description: "import" },
  { id: 8, name: "record_export", description: "record_export" },
  { id: 9, name: "assign", description: "assign" },
  { id: 10, name: "print", description: "print" },
  { id: 11, name: "email_resend", description: "email_resend" },
  { id: 12, name: "generate_vector", description: "generate_vector" },
  { id: 13, name: "child_details", description: "child_details" },
  { id: 14, name: "popup_add", description: "popup_add" },
  { id: 15, name: "popup_edit", description: "popup_edit" },
  { id: 16, name: "popup_details", description: "popup_details" },
  { id: 17, name: "reset_password", description: "reset_password" },
  { id: 18, name: "export_pdf", description: "export_pdf" }
];
async function actionTypeSeeder(company_id) {
  try {
    await prisma.actionType.deleteMany();
    for (const actionType of actionTypes) {
      const existingActionType = await prisma.actionType.findUnique({
        where: { id: actionType.id }
      });
      if (!existingActionType) {
        await prisma.actionType.create({
          data: {
            id: actionType.id,
            name: actionType.name,
            description: actionType.description,
            company_id
          }
        });
        console.log(
          `Created actionType with id ${actionType.id}: ${actionType.name}`
        );
      } else {
        console.log(`actionType with id ${actionType.id} already exists.`);
      }
    }
  } catch (error) {
    console.error(`Error in actionTypeSeeder: ${error}`);
    throw error;
  } finally {
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  actionTypeSeeder
});
