QrRapido/Models/ApiSubscription.cs
Ricardo Carneiro 7a0c12f8d2
Some checks failed
Deploy QR Rapido / test (push) Failing after 17s
Deploy QR Rapido / build-and-push (push) Has been skipped
Deploy QR Rapido / deploy-staging (push) Has been skipped
Deploy QR Rapido / deploy-production (push) Has been skipped
feat: api separada do front-end e area do desenvolvedor.
2026-03-08 12:40:51 -03:00

37 lines
1.2 KiB
C#

using MongoDB.Bson.Serialization.Attributes;
namespace QRRapidoApp.Models
{
/// <summary>
/// Embedded document tracking the user's API subscription (separate from the QR credits plan).
/// </summary>
public class ApiSubscription
{
[BsonElement("tier")]
public ApiPlanTier Tier { get; set; } = ApiPlanTier.Free;
/// <summary>"free" | "active" | "past_due" | "canceled"</summary>
[BsonElement("status")]
public string Status { get; set; } = "free";
[BsonElement("stripeSubscriptionId")]
public string? StripeSubscriptionId { get; set; }
[BsonElement("stripeCustomerId")]
public string? StripeCustomerId { get; set; }
[BsonElement("currentPeriodEnd")]
public DateTime? CurrentPeriodEnd { get; set; }
[BsonElement("activatedAt")]
public DateTime? ActivatedAt { get; set; }
[BsonElement("canceledAt")]
public DateTime? CanceledAt { get; set; }
public bool IsActive => Status == "active" && (CurrentPeriodEnd == null || CurrentPeriodEnd > DateTime.UtcNow);
public ApiPlanTier EffectiveTier => IsActive ? Tier : ApiPlanTier.Free;
}
}