import { notFound, redirect } from 'next/navigation';

import { FLOOR_1, GROUND_FLOOR } from '@/constants';
import { FloorKeyType } from '@/types';
import { Locale, defaultLocale } from '@/i18n.config';

export default async function RoomPage({
  params: { floor = GROUND_FLOOR, lang },
}: {
  params: { floor?: FloorKeyType; lang: Locale };
}) {
  if (floor === GROUND_FLOOR) {
    return redirect(`${lang !== defaultLocale ? `/${lang}` : ''}/mapa`);
  }

  if (floor === FLOOR_1) {
    return redirect(`${lang !== defaultLocale ? `/${lang}` : ''}/mapa/${FLOOR_1}`);
  }

  return notFound();
};
