using Heimdall.Application.Common; using Heimdall.Application.Services; using MediatR; namespace Heimdall.Application.Discovery.Queries.GetScreenshot; public record GetScreenshotQuery(Guid SessionId, int Index) : IRequest>; public class GetScreenshotQueryHandler : IRequestHandler> { private readonly ICameraDiscoveryService _discovery; public GetScreenshotQueryHandler(ICameraDiscoveryService discovery) { _discovery = discovery; } public async Task> Handle(GetScreenshotQuery request, CancellationToken ct) { var bytes = await _discovery.GetScreenshotAsync(request.SessionId, request.Index, ct); if (bytes is null || bytes.Length == 0) return ServiceResult.NotFound("Screenshot not found"); return ServiceResult.Success(bytes); } }