<?php

namespace NoahVet\Reef\Infrastructure\Business\BSM;

use NoahVet\Reef\Bsm\Endpoint\GetAllVeterinaryGroupUser;
use NoahVet\Reef\Bsm\Model\VeterinaryGroupUserResponse;
use NoahVet\Reef\Infrastructure\Business\AbstractTeamMembersEnumerator;
use NoahVet\Reef\Iterator\Factory\ReefApiIteratorFactoryInterface;

/**
 * @extends AbstractTeamMembersEnumerator<VeterinaryGroupUserResponse>
 */
class VeterinaryGroupTeamMembersEnumerator 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,
            GetAllVeterinaryGroupUser::class,
            VeterinaryGroupUserResponse::class,
            'veterinaryGroupId',
            $entityIdResolver,
            static fn (VeterinaryGroupUserResponse $u): string => $u->getVeterinaryGroup()->getId(),
        );
    }
}
