Files
meezi/src/Meezi.Core/Platform/PlanLimitsData.cs
T

38 lines
1.6 KiB
C#
Raw Normal View History

using Meezi.Core.Constants;
using Meezi.Core.Enums;
2026-05-27 21:33:48 +03:30
namespace Meezi.Core.Platform;
/// <summary>
/// Serializable per-plan numeric limits, stored as PlatformPlanDefinition.LimitsJson
/// and editable by admins. Missing fields default to "unlimited" (or 0 for opt-in
/// quotas) so older stored JSON stays safe. Defaults come from <see cref="PlanLimits"/>.
/// </summary>
2026-05-27 21:33:48 +03:30
public class PlanLimitsData
{
public int MaxOrdersPerDay { get; set; } = int.MaxValue;
public int MaxTables { get; set; } = int.MaxValue;
2026-05-27 21:33:48 +03:30
public int MaxTerminals { get; set; } = int.MaxValue;
public int MaxCustomers { get; set; } = int.MaxValue;
public int MaxSmsPerMonth { get; set; } = 0;
2026-05-27 21:33:48 +03:30
public int MaxBranches { get; set; } = int.MaxValue;
public int MaxReportHistoryDays { get; set; } = int.MaxValue;
public int MaxMenuCategories { get; set; } = int.MaxValue;
public int MaxMenuItems { get; set; } = int.MaxValue;
public int MaxMenuAi3dPerMonth { get; set; } = 0;
2026-05-27 21:33:48 +03:30
public static PlanLimitsData ForTier(PlanTier tier) => new()
2026-05-27 21:33:48 +03:30
{
MaxOrdersPerDay = PlanLimits.MaxOrdersPerDay(tier),
MaxTables = PlanLimits.MaxTables(tier),
MaxTerminals = PlanLimits.MaxTerminals(tier),
MaxCustomers = PlanLimits.MaxCustomers(tier),
MaxSmsPerMonth = PlanLimits.MaxSmsPerMonth(tier),
MaxBranches = PlanLimits.MaxBranches(tier),
MaxReportHistoryDays = PlanLimits.MaxReportHistoryDays(tier),
MaxMenuCategories = PlanLimits.MaxMenuCategories(tier),
MaxMenuItems = PlanLimits.MaxMenuItems(tier),
MaxMenuAi3dPerMonth = PlanLimits.MaxMenuAi3dPerMonth(tier),
2026-05-27 21:33:48 +03:30
};
}