<?php

namespace NoahVet\Reef\Infrastructure\Business\BSM;

use NoahVet\Reef\Bsm\Endpoint\GetAllVeterinaryEstablishmentUser;
use NoahVet\Reef\Bsm\Model\VeterinaryEstablishmentUserResponse;
use NoahVet\Reef\Infrastructure\Business\AbstractTeamMembersEnumerator;
use NoahVet\Reef\Iterator\Factory\ReefApiIteratorFactoryInterface;

/**
 * @extends AbstractTeamMembersEnumerator<VeterinaryEstablishmentUserResponse>
 */
class VeterinaryEstablishmentTeamMembersEnumerator extends AbstractTeamMembersEnumerator
{
    public function __construct(object $client, ReefApiIteratorFactoryInterface $iteratorFactory)
    {
        /* @phpstan-ignore method.notFound */
        $entityIdResolver = static fn (object $e): string => $e->getId();

        parent::__construct(
            $client,
            $iteratorFactory,
            GetAllVeterinaryEstablishmentUser::class,
            VeterinaryEstablishmentUserResponse::class,
            'veterinaryEstablishmentId',
            $entityIdResolver,
            static fn (VeterinaryEstablishmentUserResponse $u): string => $u->getVeterinaryEstablishment()->getId(),
        );
    }
}
