const admin = require("firebase-admin");

const serviceAccount = require("./serviceAccountProd.json");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
});

let db = admin.firestore();
exports.db = db;


const { vertexAI, gemini15Flash } = require("@genkit-ai/vertexai");
const { genkit } = require("genkit");

require("dotenv").config();

require("@babel/register")({
  presets: ["@babel/preset-env", "@babel/preset-react"],
});

// configure a Genkit instance
exports.genkitInstance = genkit({
  plugins: [vertexAI({ projectId: "starsclick", location: "us-central1" })],
  logLevel: "debug",
  enableTracingAndMetrics: true,
  model: gemini15Flash, // set default model
});


exports.refsList = {
  users: db.collection("users"),
  documents: db.collection("documents"),
  logs: db.collection("logs"),
};

exports.users = require("./src/users");
exports.payments = require("./src/payments");
exports.documents = require("./src/documents");