import { ownerRoleAtLeast } from '@nexumi/shared';
import { AboutForm } from '@/components/owner/about-form';
import { getLocale, t } from '@/lib/i18n';
import { getAboutConfig } from '@/lib/owner-about';
import { requireOwnerOrRedirect } from '@/lib/owner-auth';

export default async function OwnerAboutPage() {
  const session = await requireOwnerOrRedirect('VIEWER');
  const [locale, config] = await Promise.all([getLocale(), getAboutConfig()]);
  const canEdit = ownerRoleAtLeast(session.ownerRole, 'ADMIN');

  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-2xl font-semibold">{t(locale, 'owner.about.title')}</h1>
        <p className="text-sm text-muted-foreground">{t(locale, 'owner.about.subtitle')}</p>
      </div>
      <AboutForm initialValue={config} canEdit={canEdit} />
    </div>
  );
}
