import { instanceUserRoles } from "@zmeel/db";
/**
 * Auto-provision a new SaaS user:
 * 1. Grant instance_admin role
 *
 * Company creation and membership are handled by the Welcome onboarding flow
 * (POST /companies) after signup.
 */
export async function autoProvisionSaasUser(db, opts) {
    const { userId } = opts;
    const now = new Date();
    // Make the user an instance admin
    await db.insert(instanceUserRoles).values({
        userId,
        role: "instance_admin",
        createdAt: now,
        updatedAt: now,
    });
    return { userId };
}
//# sourceMappingURL=saas-provisioning.js.map