"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 entity_type_seeds_exports = {};
__export(entity_type_seeds_exports, {
  entityTypeSeeder: () => entityTypeSeeder
});
module.exports = __toCommonJS(entity_type_seeds_exports);
var import_client = require("@prisma/pg/client");
const prisma = new import_client.PrismaClient();
const entityTypes = [
  {
    id: 1,
    name: "MasterListComponent",
    slug: "grid_builder_module",
    description: "Grid Builder Module"
  },
  {
    id: 2,
    name: "FormBuilderComponent",
    slug: "form_builder_module",
    description: "Form Builder Module"
  },
  {
    id: 3,
    name: "StaticPageComponent",
    slug: "static_page_builder_module",
    description: "Static Page Builder Module"
  },
  {
    id: 4,
    name: "EntityUserRoleMappingComponent",
    slug: "entity_user_role_map_module",
    description: "Entity User/Role Map Module"
  },
  {
    id: 5,
    name: "MenuMappingComponent",
    slug: "menu_module",
    description: "Menu Module"
  },
  {
    id: 6,
    name: "ImportMasterComponent",
    slug: "import_module",
    description: "Import Module"
  },
  {
    id: 7,
    name: "MasterEntityComponent",
    slug: "entity_form_module",
    description: "Entity Add / Edit Form Module"
  },
  {
    id: 8,
    name: "AboutlcpComponent",
    slug: "about_lcp_form_module",
    description: "About LCP Add / Edit Form Module"
  },
  {
    id: 9,
    name: "StaticPageComponent",
    slug: "common_permission_module",
    description: "About Common Permission Module"
  },
  {
    id: 10,
    name: "TreeBuilderComponent",
    slug: "tree_builder_module",
    description: "Tree Builder Module"
  }
];
async function entityTypeSeeder(company_id) {
  try {
    for (const entityType of entityTypes) {
      const existingEntity = await prisma.entityType.findUnique({
        where: { id: entityType.id }
      });
      if (!existingEntity) {
        await prisma.entityType.create({
          data: {
            id: entityType.id,
            name: entityType.name,
            slug: entityType.slug,
            description: entityType.description,
            company_id
          }
        });
        console.log(
          `Created EntityType with id ${entityType.id}: ${entityType.name}`
        );
      } else {
        console.log(`EntityType with id ${entityType.id} already exists.`);
      }
    }
  } catch (error) {
    console.error(`Error in entityTypeSeeder: ${error}`);
    throw error;
  } finally {
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  entityTypeSeeder
});
