import { OAuthSignInButton } from "@/app/sign-in/_components/signin-button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { getSession } from "@/lib/auth/session"
import { LogIn } from "lucide-react"

export default async function SignInPage() {
    const { session, redirect } = await getSession()

    if (session) {
        redirect("/dashboard")
    }

    return (
        <div className="flex justify-center items-center p-4 min-h-screen bg-background">
            <Card className="w-full max-w-md shadow-xl">
                <CardHeader className="space-y-1 text-center">
                    <div className="flex justify-center mb-4">
                        <div className="p-3 rounded-full bg-primary/10">
                            <LogIn className="w-8 h-8 text-primary" />
                        </div>
                    </div>
                    <CardTitle className="text-2xl font-bold">Welcome back</CardTitle>
                    <CardDescription>
                        Sign in to your account to continue
                    </CardDescription>
                </CardHeader>
                <CardContent className="space-y-4">
                    <OAuthSignInButton className="w-full" />
                </CardContent>
            </Card>
        </div>
    )
}
