using Managing.Application.Abstractions.Repositories;
using Managing.Application.ManageBot.Commands;
using Managing.Domain.Bots;
using MediatR;

namespace Managing.Application.ManageBot
{
    public class GetTopBotsByPnLCommandHandler(IBotRepository botRepository)
        : IRequestHandler<GetTopBotsByPnLCommand, IEnumerable<Bot>>
    {
        public async Task<IEnumerable<Bot>> Handle(GetTopBotsByPnLCommand request, CancellationToken cancellationToken)
        {
            return await botRepository.GetTopBotsByPnLAsync(request.Statuses, request.Count);
        }
    }
}
