using Fitness_core_BE.Models; namespace Fitness_core_BE.Interfaces { public interface IFacilityClassRepository { Task CreateFacilityClass(FacilityClass facilityClass); Task> GetFacilityClasses(Guid clientId, bool includeInactive = false); Task GetFacilityClassById(Guid facilityClassId); Task UpdateFacilityClass(FacilityClass facilityClass); /// Active, non-Custom classes whose OccurrencesGeneratedThrough hasn't reached /// the horizon yet -- Custom classes are never generated, their occurrences are always /// written explicitly. Task> GetClassesNeedingGenerationAsync(Guid clientId, DateTime horizon); /// Existing occurrence start times for this class in [from, to) -- for /// pre-generation dedup. The unique (FKFacilityClassId, StartTime) index is the actual /// race-safety net; this just avoids the common sequential case needlessly retrying. Task> GetExistingOccurrenceStartTimesAsync(Guid facilityClassId, DateTime from, DateTime to); Task AddOccurrencesAsync(IEnumerable occurrences); Task> GetOccurrencesForClassAsync(Guid facilityClassId, bool includeCancelled); /// Deletes occurrences that are both in the future and have zero Booking rows /// of ANY status (a Cancelled booking still holds the FK, so it would fail the delete) -- /// the safe-to-regenerate set when a class's recurrence rule changes. Returns the count /// deleted. Task DeleteFutureUnbookedOccurrencesAsync(Guid facilityClassId, DateTime nowUtc); /// Confirmed, non-cancelled ad-hoc bookings whose window overlaps an active /// (non-cancelled) class occurrence on the same facility -- surfaced to staff as a /// conflict to resolve via the existing Reschedule flow, not auto-resolved. Task> GetSchedulingConflictsAsync(Guid clientId); /// Links a newly-created CustomerPlan to the class it's sold against -- the /// "Manage Plan" action's whole reason for being a class-scoped entry point rather than /// the general Plans tab. Task LinkPlanToClassAsync(Guid customerPlanId, Guid facilityClassId); } }