namespace SharepointToolbox.Web.Core.Models;
public enum ReportRunStatus
{
Success,
Failed
}
///
/// One produced report file, listed per client. The file itself lives under
/// {ExportsFolder}/{ProfileId}/{FileName}; this record is the index entry that the
/// "Reports" list and the id-based download endpoint resolve against.
/// Persisted to reports-index.json.
///
public class GeneratedReport
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string ProfileId { get; set; } = string.Empty;
/// The schedule that produced this; null for an ad-hoc/manual run.
public string? ScheduledReportId { get; set; }
public ReportType Type { get; set; }
/// Human label (usually copied from the schedule name).
public string Name { get; set; } = string.Empty;
/// File name on disk, relative to the profile's exports subfolder.
public string FileName { get; set; } = string.Empty;
public string Mime { get; set; } = string.Empty;
public long SizeBytes { get; set; }
public DateTime GeneratedUtc { get; set; } = DateTime.UtcNow;
public ReportRunStatus Status { get; set; } = ReportRunStatus.Success;
/// Populated when is Failed.
public string? Error { get; set; }
/// True when the report was successfully emailed via Graph.
public bool Emailed { get; set; }
///
/// Populated when email delivery was requested but failed. The report itself still
/// succeeded (file is on disk) — only delivery failed.
///
public string? EmailError { get; set; }
}