import "server-only";
import { db } from "@/lib/db/client";
import { adminAudit } from "@/lib/db/schema";

export async function logAdminAction(args: {
  adminUserId: string;
  action: string;
  targetId?: string;
  metadata?: Record<string, unknown>;
}) {
  await db.insert(adminAudit).values({
    adminUserId: args.adminUserId,
    action: args.action,
    targetId: args.targetId ?? null,
    metadata: args.metadata ?? null,
  });
}
