'use client';
import { Stack } from '@mui/material';
import { useTranslations } from 'next-intl';
import { PageHeader, ProfileSummary, StatusChip, SurfaceCard } from '@/components';
import { SettingsPanel, SignOutRow } from '@/components/settings';
import { useMyPartnerCenter } from '@/services/partnerCenter';

/**
 * «بیشتر» group root for the partner portal — the center's identity and merchant-of-record status
 * (previously squeezed into the top bar, where the MoR indicator was hidden below `sm`), plus
 * appearance/language and sign-out.
 */
export default function PartnerMorePage() {
  const t = useTranslations('hub');
  const tPartner = useTranslations('partner');
  const { data: center, isLoading } = useMyPartnerCenter();

  return (
    <Stack sx={{ gap: 2 }}>
      <PageHeader title={t('more_title')} />

      <SurfaceCard>
        <Stack sx={{ gap: 1.5, alignItems: 'center' }}>
          <ProfileSummary displayName={center?.name ?? ''} loading={isLoading} />
          {!isLoading && center ? (
            <StatusChip
              status={center.isMerchantOfRecord ? 'active' : 'neutral'}
              label={center.isMerchantOfRecord ? tPartner('is_mor_yes') : tPartner('is_mor_no')}
            />
          ) : null}
        </Stack>
      </SurfaceCard>

      <SettingsPanel />
      <SignOutRow />
    </Stack>
  );
}
