import { createRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";

export interface RouterContext {
  auth: {
    session: object | null;
    isPending: boolean;
    isAuthenticated: boolean;
    signIn: (password: string) => Promise<void>;
    signOut: () => Promise<void>;
    changePassword: (currentPassword: string, newPassword: string) => Promise<void>;
  };
}

const router = createRouter({
  routeTree,
  context: {} as RouterContext,
});

declare module "@tanstack/react-router" {
  interface Register {
    router: typeof router;
  }
}

export { router };
