39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Fitness_core_BE.Models
|
|
{
|
|
/// <summary>
|
|
/// Links a customer to a subscription. Every subscription has one IsPrimary row
|
|
/// (mirroring CustomerSubscription.FKCustomerId); group plans add more rows up to
|
|
/// the plan's MemberLimit. The primary row is never removed.
|
|
/// </summary>
|
|
public class SubscriptionMember
|
|
{
|
|
[Key]
|
|
public Guid SubscriptionMemberId { get; set; }
|
|
|
|
public Guid FKSubscriptionId { get; set; }
|
|
[ForeignKey("FKSubscriptionId")]
|
|
public virtual CustomerSubscription Subscription { get; set; }
|
|
|
|
// Tenant-bucket entity: this FK holds a TenantCustomerLinkId (not the central
|
|
// Customer.CusId directly) -- see Models/TenantCustomerLink.cs.
|
|
public Guid FKCustomerId { get; set; }
|
|
[ForeignKey("FKCustomerId")]
|
|
public virtual TenantCustomerLink TenantCustomerLink { get; set; }
|
|
|
|
public bool IsPrimary { get; set; }
|
|
public DateTime JoinedAt { get; set; } = DateTime.UtcNow;
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Whether the member is currently *using* this plan. Unassigning clears this and
|
|
/// leaves IsActive alone, so the member keeps their row in the gym's member list
|
|
/// (and their access/device enrollment) and the same button can re-assign them.
|
|
/// IsActive stays reserved for a real removal, which does hide the row.
|
|
/// </summary>
|
|
public bool IsPlanAssigned { get; set; } = true;
|
|
}
|
|
}
|