import { useMe, isLegalEntity } from '@features/auth'
import { IndividualFields } from './IndividualFields'
import { LegalEntityFields } from './LegalEntityFields'

// Picks the right field set for the account type. Phone editing lives inside
// IndividualFields (the only branch with an editable phone).
export function ProfileDetails() {
  const { data } = useMe()
  if (!data) return null

  return isLegalEntity(data) ? <LegalEntityFields data={data} /> : <IndividualFields data={data} />
}
