54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using ManagerService.DTOs;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace ManagerService.Data
|
|
{
|
|
public class SubscriptionPlan
|
|
{
|
|
[Key]
|
|
[Required]
|
|
public string Id { get; set; }
|
|
|
|
[Required]
|
|
public string Name { get; set; }
|
|
|
|
public long StorageQuotaBytes { get; set; } = 0;
|
|
|
|
public int AiRequestsPerMonth { get; set; } = 0;
|
|
|
|
/// <summary>Whether the plan includes any stats at all.</summary>
|
|
public bool HasStats { get; set; } = false;
|
|
|
|
/// <summary>Max history in days for stats. 0 = unlimited (Premium).</summary>
|
|
public int StatsHistoryDays { get; set; } = 30;
|
|
|
|
/// <summary>Whether the plan includes advanced stats (POI, quiz, game, articles, QR, etc.).</summary>
|
|
public bool HasAdvancedStats { get; set; } = false;
|
|
|
|
public SubscriptionPlanDTO ToDTO()
|
|
{
|
|
return new SubscriptionPlanDTO
|
|
{
|
|
id = Id,
|
|
name = Name,
|
|
storageQuotaBytes = StorageQuotaBytes,
|
|
aiRequestsPerMonth = AiRequestsPerMonth,
|
|
hasStats = HasStats,
|
|
statsHistoryDays = StatsHistoryDays,
|
|
hasAdvancedStats = HasAdvancedStats,
|
|
};
|
|
}
|
|
|
|
public SubscriptionPlan FromDTO(SubscriptionPlanDTO dto)
|
|
{
|
|
Name = dto.name;
|
|
StorageQuotaBytes = dto.storageQuotaBytes;
|
|
AiRequestsPerMonth = dto.aiRequestsPerMonth;
|
|
HasStats = dto.hasStats;
|
|
StatsHistoryDays = dto.statsHistoryDays;
|
|
HasAdvancedStats = dto.hasAdvancedStats;
|
|
return this;
|
|
}
|
|
}
|
|
}
|