<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\User;
use Illuminate\Support\Collection;

/**
 * @var string               $age
 * @var Individual           $record
 * @var Collection<int,User> $users
 */
?>

<?php if ($record->getBirthDate()->isOK() || $record->getDeathDate()->isOK()) : ?>
    <?= $record->fullName() ?>, <?= $record->lifespan() ?>
<?php else : ?>
    <?= $record->fullName() ?>
<?php endif ?></?>
<?= $age ?>
<?php if (Auth::isAdmin()) : ?>
    <?php foreach ($users as $user) : ?>
        — <a href="<?= e(route(UserListPage::class, ['filter' => $user->email()])) ?>">
            <?= e($user->userName()) ?>
        </a>
    <?php endforeach ?>
<?php endif ?>
