import LinkRouting from "@/core/components/LinkRouting";
import {Stack} from "@mui/material";
import {useRouter} from "next/router";
import {useTranslations} from "next-intl";

const LoginLinkRouting  = () => {
    const t = useTranslations();
    const router = useRouter()
    const backUrlDecodedPath = router.query?.back_url

    return (
        <Stack direction="row" alignItems="center" justifyContent="center">
            <LinkRouting
                data-testid="link_routing"
                sx={{margin: 2}}
                href={
                    backUrlDecodedPath ? decodeURIComponent(backUrlDecodedPath) : "/"
                }
            >
                {t("LoginPage.link_routing_back_to")}{" "}
                {backUrlDecodedPath
                    ? t("LoginPage.link_routing_previuos_page")
                    : t("LoginPage.link_routing_main_page")}
            </LinkRouting>
        </Stack>
    )
}
export default LoginLinkRouting