"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 status_seeds_exports = {};
__export(status_seeds_exports, {
  statusSeeder: () => statusSeeder
});
module.exports = __toCommonJS(status_seeds_exports);
var import_client = require("@prisma/pg/client");
const prisma = new import_client.PrismaClient();
async function statusSeeder() {
  try {
    const statusArr = [
      { id: 1, name: "Active", slug: "active" },
      { id: 2, name: "InActive", slug: "inactive" },
      { id: 3, name: "Delete", slug: "delete" }
    ];
    for (const status of statusArr) {
      await findOrCreateStatus(status);
    }
    console.log("Status creation completed.");
  } catch (error) {
    throw error;
  }
}
async function findOrCreateStatus(status) {
  try {
    let resData;
    resData = await prisma.status.findUnique({ where: { id: status.id } });
    if (!resData) {
      let data = {
        ...status
      };
      resData = await prisma.status.create({
        data
      });
      console.log(`Status created successfully: ${status.name}`);
    } else {
      let data = {
        ...status
      };
      resData = await prisma.status.update({
        where: { id: resData.id },
        data
      });
      console.log(`Status updated successfully: ${resData.name}`);
    }
    return resData;
  } catch (error) {
    console.log(`Status seeder failed: ${status.name}`);
    throw error;
  } finally {
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  statusSeeder
});
