using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fitness_core_BE.Models { /// One deduction event against a TimeBankCard's balance — an append-only ledger so /// MinutesRemaining is always auditable/reconstructable, the same reasoning as LedgerEntry /// for money. public class TimeBankCardUsageLog { [Key] public Guid TimeBankCardUsageLogId { get; set; } public Guid FKTimeBankCardId { get; set; } [ForeignKey(nameof(FKTimeBankCardId))] public TimeBankCard TimeBankCard { get; set; } public Guid FKClientId { get; set; } [ForeignKey(nameof(FKClientId))] public Client Client { get; set; } // Which facility this swipe/use was against -- not a FacilitySession, since a time-bank // card is spent on open-ended usage (e.g. "swim for however long"), not a fixed // pre-booked slot the way Booking is. public Guid FKFacilityId { get; set; } [ForeignKey(nameof(FKFacilityId))] public Facility Facility { get; set; } public int MinutesDeducted { get; set; } public int MinutesRemainingAfter { get; set; } public DateTime UsedAt { get; set; } = DateTime.UtcNow; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; } }