Files
PowderCoatingLogix/src/PowderCoating.Core/Entities/SubscriptionPlanConfig.cs
T
spouliot cb7bbc37bd Add three-layer feature gating for AI Catalog Price Check
Adds platform-level, plan-level (Enterprise only), and per-company
toggles for the AI Catalog Price Check feature. Includes:
- Company.AiCatalogPriceCheckEnabled per-company flag
- SubscriptionPlanConfig.AllowAiCatalogPriceCheck plan-level flag
- PlatformSetting 'AiCatalogPriceCheckEnabled' global kill switch
- IPlatformSettingsService.GetBoolAsync helper
- ISubscriptionService.CanUseAiCatalogPriceCheckAsync
- UI controls in Companies/Edit, PlatformSubscription/Edit+Index,
  and SubscriptionManagement/Manage
- Migration AddAiCatalogPriceCheckGating applied

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 08:29:51 -04:00

55 lines
2.6 KiB
C#

namespace PowderCoating.Core.Entities;
/// <summary>
/// Stores plan limits and pricing in the database so SuperAdmins can edit without a code deploy.
/// Global (not per-company). CompanyId is set to 0 / unused. No tenant query filter applied.
/// The Plan integer is the identifier that links Company.SubscriptionPlan to a config row.
/// </summary>
public class SubscriptionPlanConfig : BaseEntity
{
public int Plan { get; set; }
public string DisplayName { get; set; } = string.Empty;
public string? Description { get; set; }
/// <summary>-1 = unlimited</summary>
public int MaxUsers { get; set; }
/// <summary>-1 = unlimited</summary>
public int MaxActiveJobs { get; set; }
/// <summary>-1 = unlimited</summary>
public int MaxCustomers { get; set; }
/// <summary>-1 = unlimited. Counts active (non-terminal) quotes.</summary>
public int MaxQuotes { get; set; } = -1;
/// <summary>-1 = unlimited. Counts total non-deleted catalog items.</summary>
public int MaxCatalogItems { get; set; } = -1;
/// <summary>-1 = unlimited. Max job photos per job.</summary>
public int MaxJobPhotos { get; set; } = -1;
/// <summary>-1 = unlimited. Max general (non-AI) photos per quote.</summary>
public int MaxQuotePhotos { get; set; } = -1;
/// <summary>-1 = unlimited. 0 = AI photo quotes disabled for this plan. Monthly limit per company.</summary>
public int MaxAiPhotoQuotesPerMonth { get; set; } = -1;
public decimal MonthlyPrice { get; set; }
public decimal AnnualPrice { get; set; }
public string? StripePriceIdMonthly { get; set; }
public string? StripePriceIdAnnual { get; set; }
/// <summary>When true, companies on this plan can connect Stripe and accept online invoice payments.</summary>
public bool AllowOnlinePayments { get; set; } = false;
/// <summary>When true, companies on this plan can access accounting features: Chart of Accounts, Bills, Expenses, and Accounting Export.</summary>
public bool AllowAccounting { get; set; } = false;
/// <summary>When true, companies on this plan can use AI Photo Quote analysis (subject to MaxAiPhotoQuotesPerMonth).</summary>
public bool AllowAiPhotoQuotes { get; set; } = false;
/// <summary>When true, companies on this plan can use the AI Inventory Assist lookup feature.</summary>
public bool AllowAiInventoryAssist { get; set; } = false;
/// <summary>When true, companies on this plan can run the AI Catalog Price Check (Enterprise only).</summary>
public bool AllowAiCatalogPriceCheck { get; set; } = false;
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}