import { prisma } from "../config/prisma";

interface AuditEntry {
  userId?: string;
  tenantId?: string;
  action: string;
  resource: string;
  resourceId?: string;
  metadata?: Record<string, unknown>;
}

export async function recordAuditLog(entry: AuditEntry) {
  // Todo: add an AuditLog model in schema.prisma before using this in production
  try {
    // await prisma.auditLog.create({ data: entry });
    console.log("[audit]", entry);
  } catch (err) {
    console.error("Failed to write audit log", err);
  }
}
