"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/sql/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" }
];
async function actionTypeSeeder(company_id) {
  try {
    console.log("\u{1F680} Starting ActionType Seeder...");
    await prisma.$transaction(async (tx) => {
      for (const actionType of actionTypes) {
        const existingActionType = await tx.actionType.findUnique({
          where: { id: actionType.id }
        });
        if (!existingActionType) {
          await tx.$executeRawUnsafe(`
            SET IDENTITY_INSERT action_types ON;
            INSERT INTO action_types (id, name, description, company_id) 
            VALUES (${actionType.id}, '${actionType.name}', '${actionType.description}', ${company_id});
            SET IDENTITY_INSERT action_types OFF;
          `);
          console.log(`\u2705 Created ActionType with id ${actionType.id}: ${actionType.name}`);
        } else {
          console.log(`\u{1F504} ActionType with id ${actionType.id} already exists.`);
        }
      }
    });
    console.log("\u2705 ActionType seeder completed successfully.");
  } catch (error) {
    console.error(`\u274C Error in actionTypeSeeder: ${error}`);
    throw error;
  } finally {
    await prisma.$disconnect();
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  actionTypeSeeder
});
