import { expoClient } from "@better-auth/expo/client";
import { stripeClient } from "@bowong/better-auth-stripe/client";
import { usernameClient } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";
import { storage } from '../storage';
export const authClient = createAuthClient({
  baseURL: "https://api.mixvideo.bowong.cc/api/auth",
  fetchOptions: {
    credentials: "omit",
    auth: {
      type: 'Bearer',
      token: () => storage.getItem(`bestaibest.better-auth.session_token`) || ``
    }
  },
  plugins: [
    expoClient({
      scheme: "bestaibestwebapp",
      storagePrefix: "bestaibest",
      storage: storage,
    }),
    usernameClient(),
    stripeClient({ subscription: true }),
  ],
});

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