'use client';

import { getClientShellMessages } from '@/lib/localization/client-messages';
import {
  isLocale,
  localizedModePath,
  modeFromPathname,
} from '@/lib/localization/config';
import { usePathname } from 'next/navigation';
import { StateAction, StateActions, StateShell } from './StateShell';

export function LocalizedNotFound() {
  const pathname = usePathname();
  const localeValue = pathname.split('/').filter(Boolean)[0];
  const locale = isLocale(localeValue) ? localeValue : 'en';
  const mode = modeFromPathname(pathname);
  const messages = getClientShellMessages(locale);
  return (
    <StateShell title={messages.states.notFoundTitle} body={messages.states.notFoundBody}>
      <StateActions>
        <StateAction href={localizedModePath('home', locale, mode)}>
          {messages.states.backHome}
        </StateAction>
      </StateActions>
    </StateShell>
  );
}
