using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Fitness_core_BE.Models
{
/// One scheduled, bookable occurrence of a Facility (e.g. "Pool, Tue 6-7pm").
/// Capacity is enforced by counting non-cancelled Bookings against this row, not by a
/// denormalized counter, to avoid drift between the two.
public class FacilitySession
{
[Key]
public Guid FacilitySessionId { get; set; }
public Guid FKFacilityId { get; set; }
[ForeignKey(nameof(FKFacilityId))]
public Facility Facility { get; set; }
public Guid FKClientId { get; set; }
[ForeignKey(nameof(FKClientId))]
public Client Client { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
/// Overrides Facility.DefaultCapacity when set; null = use the facility default.
public int? Capacity { get; set; }
public bool IsCancelled { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public virtual ICollection Bookings { get; set; }
}
}