import { makeGetServerSideProps } from '.';
import * as Calculation from '@/Components/Calculation';
import { Error } from '@/Components/Common/Error';
import { Grid } from '@/Components/Layout/Page';
import Output from '@/Components/Output';
import { unlimitedRoles } from '@/config/users';
import { useGetUsers, useInsuranceData, useMainData, useReactions } from '@/process/hooks';
import { useStore } from '@/stores/hooks';
import Head from 'next/head';

export default function Unlimited(props) {
  const store = useStore();
  store.$process.add('Unlimited');

  useMainData();
  useGetUsers();
  useInsuranceData();
  useReactions();

  if (props.statusCode !== 200) return <Error {...props} />;

  return (
    <Grid>
      <Head>
        <title>Лизинговый калькулятор без ограничений - Эволюция</title>
        <meta name="description" content="Лизинговый калькулятор без ограничений - Эволюция" />
      </Head>
      <Calculation.Form />
      <Calculation.Settings />
      <Output />
    </Grid>
  );
}

export const getServerSideProps = makeGetServerSideProps({
  roles: unlimitedRoles,
});
