import RolePermissionMiddleware from "@/middlewares/RolePermission";
import WithAuthMiddleware from "@/middlewares/WithAuth";
import {parse} from "next-useragent";
import DashboardDevelopmentAssistantComponent from "@/components/dashboard/development-assistant";

const requiredPermissions = ["development_assistant"];
export default function DevelopmentAssistant() {
    return (
        <WithAuthMiddleware>
            <RolePermissionMiddleware requiredPermissions={requiredPermissions}>
                <DashboardDevelopmentAssistantComponent/>
            </RolePermissionMiddleware>
        </WithAuthMiddleware>
    );
}

export async function getServerSideProps({req, locale}) {
    const {isBot} = parse(req.headers["user-agent"]);
    return {
        props: {
            messages: (await import(`&/locales/${locale}/app.json`)).default,
            title: "Dashboard.development_assistant_page",
            isBot,
        },
    };
}
