import { db } from './drizzle/db';
import { users, tenants, saasPackages } from './drizzle/schema';
import { eq } from 'drizzle-orm';

async function test() {
  try {
    console.log("Connecting...");
    const userResult = await db.select({
      id: users.id,
      email: users.email,
      tenantName: tenants.name,
      tenantLicenses: tenants.licenses,
      mediaEngineStrategy: tenants.mediaEngineStrategy,
      chatEngineStrategy: tenants.chatEngineStrategy,
      userLicenses: users.licenses,
      packageFeatures: saasPackages.features
    })
    .from(users)
    .innerJoin(tenants, eq(users.tenantId, tenants.id))
    .leftJoin(saasPackages, eq(tenants.packageId, saasPackages.id))
    .limit(1);
    console.log("Success:", userResult);
  } catch (e) {
    console.log("ERROR:", e);
  }
  process.exit(0);
}
test();
