<?php 
 
namespace App\Controller\Agent\Agent; 
 
use App\Repository\AgentRepository; 
use Symfony\Component\HttpFoundation\JsonResponse; 
use Symfony\Component\Routing\Annotation\Route; 
 
class FetchAgentController 
{ 
    private AgentRepository $repo; 
 
    public function __construct(AgentRepository $repo) 
    { 
        $this->repo = $repo; 
    } 
 
    /** 
     * @Route("/api/internal/best/agent", name="getBestAgentByMandate") 
     */ 
    public function getBestAgentByMandate(): JsonResponse 
    { 
        return new JsonResponse($this->repo->getTopAgentByMandate(), 200); 
    } 
}