import { adminClient, genericOAuthClient } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";
import { ac, admin, systemAdmin, user } from "./auth-permissions";

export const authClient = createAuthClient({
	baseURL: `${window.location.origin}/lst/api/auth`,
	plugins: [
		adminClient({
			ac,
			roles: {
				admin,
				user,
				systemAdmin,
			},
		}),
		genericOAuthClient(),
	],
});

export const { useSession, signUp, signIn, signOut } = authClient;
