import { TeamManager } from '@/components/owner/owner-forms';
import { env } from '@/lib/env';
import { getLocale, t } from '@/lib/i18n';
import { prisma } from '@/lib/prisma';

export default async function OwnerTeamPage() {
  const [locale, members] = await Promise.all([
    getLocale(),
    prisma.ownerTeamMember.findMany({ orderBy: { createdAt: 'asc' } })
  ]);

  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-2xl font-semibold">{t(locale, 'owner.team.title')}</h1>
        <p className="text-sm text-muted-foreground">{t(locale, 'owner.team.subtitle')}</p>
      </div>
      <TeamManager bootstrapOwnerIds={env.OWNER_USER_IDS ?? []} initialMembers={members} />
    </div>
  );
}
