namespace SharepointToolbox.Core.Models;

/// <summary>
/// Represents storage consumption for a single file extension across all scanned libraries.
/// Produced by IStorageService.CollectFileTypeMetricsAsync and consumed by chart bindings.
/// </summary>
public record FileTypeMetric(
    /// <summary>File extension including dot, e.g. ".docx", ".pdf". Empty string for extensionless files.</summary>
    string Extension,
    /// <summary>Total size in bytes of all files with this extension.</summary>
    long TotalSizeBytes,
    /// <summary>Number of files with this extension.</summary>
    int FileCount)
{
    /// <summary>
    /// Human-friendly display label: ".docx" becomes "DOCX", empty becomes "No Extension".
    /// </summary>
    public string DisplayLabel => string.IsNullOrEmpty(Extension)
        ? "No Extension"
        : Extension.TrimStart('.').ToUpperInvariant();
}
