"use client";

import { Button } from "@mosaic/ui";
import { API_BASE_URL } from "@/lib/config";

export function LoginButton(): React.JSX.Element {
  const handleLogin = (): void => {
    // Redirect to the backend OIDC authentication endpoint
    // BetterAuth will handle the OIDC flow and redirect back to the callback
    window.location.assign(`${API_BASE_URL}/auth/signin/authentik`);
  };

  return (
    <Button variant="primary" onClick={handleLogin} className="w-full">
      Sign In with Authentik
    </Button>
  );
}
