using InboxIntel.Application.Abstractions; using Microsoft.AspNetCore.Mvc; namespace InboxIntel.Api.Controllers; public class ExportController : ApiControllerBase { private readonly IExportService _export; public ExportController(IExportService export) => _export = export; /// Export an inbox report. format = pdf | csv | json. [HttpGet("report")] public async Task Report([FromQuery] string format = "pdf", CancellationToken ct = default) { var fmt = format.ToLowerInvariant() switch { "csv" => ExportFormat.Csv, "json" => ExportFormat.Json, _ => ExportFormat.Pdf }; var (content, contentType, fileName) = await _export.ExportReportAsync(UserId, fmt, ct); return File(content, contentType, fileName); } }