using Managing.Application.Abstractions.Services;
using Managing.Application.ManageBot.Commands;
using Managing.Domain.Statistics;
using MediatR;

namespace Managing.Application.ManageBot
{
    /// <summary>
    /// Handler for retrieving all agent summaries with complete data
    /// </summary>
    public class GetAllAgentSummariesCommandHandler : IRequestHandler<GetAllAgentSummariesCommand,
        IEnumerable<AgentSummary>>
    {
        private readonly IAgentService _agentService;

        public GetAllAgentSummariesCommandHandler(IAgentService agentService)
        {
            _agentService = agentService;
        }

        public async Task<IEnumerable<AgentSummary>> Handle(GetAllAgentSummariesCommand request,
            CancellationToken cancellationToken)
        {
            // Get all agent summaries from the database
            var allAgentSummaries = await _agentService.GetAllAgentSummaries();

            return allAgentSummaries;
        }

    }
}