namespace Tiku.Application.Security;

public sealed record ReconcileFeatureUsageRequest(
    Guid TenantId,
    SystemScopeCallerType CallerType,
    string Caller,
    string Reason,
    string CorrelationId);

public sealed record ReconciledFeatureUsage(
    string MetricCode,
    long ActualValue,
    long LimitValue,
    bool Warning,
    bool Exceeded);

public interface IFeatureUsageReconciliationService
{
    Task<IReadOnlyCollection<ReconciledFeatureUsage>> ReconcileTenantAsync(
        ReconcileFeatureUsageRequest request,
        CancellationToken cancellationToken = default);

    Task<int> ProcessDueAsync(CancellationToken cancellationToken = default);
}

public sealed class FeatureUsageReconciliationOptions
{
    public bool Enabled { get; set; } = true;
    public int BatchSize { get; set; } = 100;
    public int IntervalMinutes { get; set; } = 60;
}
