import RegisterForm from "@/components/auth/Register";
import { LstCard } from "@/components/extendedUI/LstCard";
import { CardContent, CardHeader } from "@/components/ui/card";
import { createFileRoute, redirect } from "@tanstack/react-router";

export const Route = createFileRoute("/register")({
    component: RouteComponent,
    beforeLoad: () => {
        const isLoggedIn = localStorage.getItem("auth_token");
        if (isLoggedIn) {
            throw redirect({
                to: "/",
            });
        }
    },
});

function RouteComponent() {
    return (
        <div className="flex flex-row w-5/6 justify-between gap-2">
            <RegisterForm />
            <div>
                <LstCard>
                    <CardHeader>
                        <h2 className="text-2xl font-bold mb-4">
                            Disclaimer and User Agreement
                        </h2>
                    </CardHeader>
                    <CardContent>
                        <div className="max-w-2xl mx-auto p-6 rounded-2xl shadow-md">
                            <ul className="list-decimal list-inside space-y-3">
                                <li>
                                    <span className="font-bold">
                                        Authentication Notice:
                                    </span>
                                    <span>
                                        The username, email, and password are
                                        only for LST you <em>DO NOT</em>Need to
                                        use Windows username if you do not wish
                                        to.
                                    </span>
                                </li>
                                {/* <li>
                                    <span className="font-bold">
                                        Password Privacy and Security:
                                    </span>
                                    This application{" "}
                                    <span className="font-semibold">
                                        does not store, sync, or transmit
                                    </span>{" "}
                                    your Windows password in any form.
                                    Authentication is handled securely, and your
                                    credentials are never logged or accessible
                                    to the developers or third parties.
                                </li> */}
                                <li>
                                    <span className="font-bold">
                                        Data Handling:
                                    </span>
                                    All data accessed through the Alpla prod
                                    remains the property of Alpla. The app
                                    functions as a secure interface for
                                    accessing and updating this information
                                    where permitted by your role.
                                </li>
                                <li>
                                    <span className="font-bold">
                                        User Responsibility:
                                    </span>
                                    You are responsible for any actions
                                    performed using your account. Please ensure
                                    you do not share your credentials with
                                    others and always log out of the application
                                    when not in use.
                                </li>
                                <li>
                                    <span className="font-bold">
                                        No Warranty:
                                    </span>
                                    This application is provided "
                                    <span className="italic">as is</span>"
                                    without any warranty of any kind, either
                                    expressed or implied. While every effort is
                                    made to ensure functionality and data
                                    accuracy, the app is subject to ongoing
                                    development and may contain bugs or require
                                    updates.
                                </li>
                                <li>
                                    <span className="font-bold">
                                        Consent Required:
                                    </span>
                                    By signing up or continuing to use this
                                    application, you agree to the above terms
                                    and acknowledge that you understand how your
                                    login information is used.
                                </li>
                            </ul>
                        </div>
                    </CardContent>
                </LstCard>
            </div>
        </div>
    );
}
