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

namespace Managing.Application.ManageBot
{
    public class GetBotsByUserAndStatusCommandHandler(IBotService botService)
        : IRequestHandler<GetBotsByUserAndStatusCommand, IEnumerable<Bot>>
    {
        public async Task<IEnumerable<Bot>> Handle(GetBotsByUserAndStatusCommand request, CancellationToken cancellationToken)
        {
            // Get all bots for the user
            var userBots = await botService.GetBotsByUser(request.UserId);
            
            // Filter by status
            return userBots.Where(bot => bot.Status == request.Status);
        }
    }
} 