namespace PowderCoating.Application.Interfaces;

/// <summary>Pre-aggregated AI call counts for one company across four time windows.</summary>
public record AiCompanyUsage(int CompanyId, int Today, int Last7Days, int Last30Days, int AllTime);

/// <summary>Count of AI calls for a specific feature within a company (last 30 days).</summary>
public record AiFeatureStat(int CompanyId, string Feature, int Count);

/// <summary>Bundled result returned by <see cref="IAiUsageReportService.GetReportDataAsync"/>.</summary>
public record AiUsageReportData(
    List<AiCompanyUsage> UsageByCompany,
    List<AiFeatureStat> FeatureStats,
    Dictionary<int, int> PhotoCountsByCompany);

/// <summary>
/// Read-only service for the platform AI usage analytics report. Queries <c>AiUsageLogs</c>
/// and <c>QuotePhotos</c> (cross-tenant, non-BaseEntity) via <c>ApplicationDbContext</c>
/// directly so that <see cref="AiUsageReportController"/> does not need a direct DB context reference.
/// Implemented in Infrastructure; used as Tier-3 aggregate report service.
/// </summary>
public interface IAiUsageReportService
{
    /// <summary>
    /// Returns all the aggregated AI usage data needed to render the platform AI usage report:
    /// per-company call counts across today / 7-day / 30-day / all-time windows,
    /// feature stats for the last 30 days, and AI photo upload counts per company.
    /// </summary>
    Task<AiUsageReportData> GetReportDataAsync();
}
