'use client';

import { getClientShellMessages } from '@/lib/localization/client-messages';
import { isLocale, localizedPath } 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 messages = getClientShellMessages(locale);
  return (
    <StateShell title={messages.states.notFoundTitle} body={messages.states.notFoundBody}>
      <StateActions>
        <StateAction href={localizedPath('home', locale)}>{messages.states.backHome}</StateAction>
      </StateActions>
    </StateShell>
  );
}
