using PowderCoating.Core.Entities;
using PowderCoating.Core.Enums;

namespace PowderCoating.Core.Interfaces;

public interface ISubscriptionService
{
    Task<bool> CanAddUserAsync(int companyId);
    Task<bool> CanAddJobAsync(int companyId);
    Task<bool> CanAddCustomerAsync(int companyId);
    Task<bool> CanAddQuoteAsync(int companyId);
    Task<bool> CanAddCatalogItemAsync(int companyId);
    Task<bool> CanAddJobPhotoAsync(int companyId, int jobId);
    Task<bool> CanAddQuotePhotoAsync(int companyId, int quoteId);
    Task<(int Used, int Max)> GetUserCountAsync(int companyId);
    Task<(int Used, int Max)> GetJobCountAsync(int companyId);
    Task<(int Used, int Max)> GetCustomerCountAsync(int companyId);
    Task<(int Used, int Max)> GetQuoteCountAsync(int companyId);
    Task<(int Used, int Max)> GetCatalogItemCountAsync(int companyId);
    Task<(int Used, int Max)> GetJobPhotoCountAsync(int companyId, int jobId);
    Task<(int Used, int Max)> GetQuotePhotoCountAsync(int companyId, int quoteId);
    Task<SubscriptionStatus> GetStatusAsync(int companyId);

    // AI feature gating
    /// <summary>Returns true if the AI Inventory Assist lookup is enabled for this company.</summary>
    Task<bool> IsAiInventoryAssistEnabledAsync(int companyId);
    /// <summary>Returns true if the AI Photo Quote feature is enabled for this company (flag + quota check).</summary>
    Task<bool> CanUseAiPhotoQuoteAsync(int companyId);
    /// <summary>Returns (used this month, monthly max). Max = -1 means unlimited.</summary>
    Task<(int Used, int Max)> GetAiPhotoQuoteUsageAsync(int companyId);
    /// <summary>Returns true if the AI Catalog Price Check is enabled for this company (plan gate + per-company flag).</summary>
    Task<bool> CanUseAiCatalogPriceCheckAsync(int companyId);

    /// <summary>
    /// Returns days until expiry (negative = days past expiry). Returns null if no end date set.
    /// </summary>
    int? DaysUntilExpiry(Company company);
}
