namespace PowderCoating.Application.DTOs.Health;

public enum ConfigIssueSeverity { Info, Warning, Critical }

/// <summary>
/// A single configuration gap detected for a tenant company.
/// </summary>
public class ConfigHealthIssue
{
    public string Code { get; set; } = "";
    public string Title { get; set; } = "";
    public string Detail { get; set; } = "";
    public ConfigIssueSeverity Severity { get; set; }
    public string? FixPath { get; set; }
    public string? FixLabel { get; set; }
}

/// <summary>
/// Aggregate config health result for one company.
/// </summary>
public class CompanyConfigHealth
{
    public int CompanyId { get; set; }
    public List<ConfigHealthIssue> Issues { get; set; } = new();

    public bool IsHealthy => Issues.Count == 0;
    public int CriticalCount => Issues.Count(i => i.Severity == ConfigIssueSeverity.Critical);
    public int WarningCount => Issues.Count(i => i.Severity == ConfigIssueSeverity.Warning);
    public int InfoCount => Issues.Count(i => i.Severity == ConfigIssueSeverity.Info);

    public ConfigIssueSeverity OverallSeverity => Issues.Count == 0
        ? ConfigIssueSeverity.Info
        : Issues.Max(i => i.Severity);
}
