Files
Core_Be/Interfaces/Services/IBookingService.cs
T
HarithaRandunu 5d711bd13e Facility booking-mode redesign, multi-plan subscriptions, and Classes
Implements the facility-classes-booking-dashboard plan (backend):

- Facility.BookingMode (single Scheduled/AdHoc choice) replaced with
  independent SupportsClasses/SupportsBooking flags, so one facility
  can run a class and accept walk-in bookings; a running class now
  blocks walk-in booking for its window on both create and reschedule.
- CustomerPlan.GrantsGymAccess + CustomerPlanClass join table let a
  customer hold one gym-access plan plus any number of class-only
  plans. Replaced the old single-subscription resolution
  (GetActiveSubscriptionByCustomerId/HasAnyActiveSubscriptionAsync)
  with gym-access-aware and class-aware resolvers across booking
  creation/cancellation, plan assignment, and customer self-service.
  Fixed ChangeMembershipPlan/renewal plan-changes, which resolved "the
  subscription to replace" by most-recent-created and would have
  deactivated a member's class subscription instead of their gym one.
- New FacilityClass model: recurring class definitions (Daily/Weekly/
  Monthly/Custom) with lazy occurrence generation (8-week horizon,
  race-safe via a unique index) and proper unlimited-capacity handling.
  "Mark not held" replaces the old bare-cancel: cascades to cancel and
  refund every confirmed booking on the occurrence through the same
  core CancelBooking uses, and frees the slot for walk-in booking.
  Scheduling conflicts (a walk-in booking now overlapping a class) are
  surfaced for staff to resolve via the existing Reschedule flow.
- Renamed the pre-existing "AdHoc" booking-mode terminology to
  "WalkIn" throughout (routes, methods, DTOs, the stored BookingMode
  value) for a clearer, simpler name.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09 14:26:59 +05:30

74 lines
4.0 KiB
C#

using Fitness_core_BE.Models;
using Microsoft.AspNetCore.Http;
namespace Fitness_core_BE.Interfaces.Services
{
public interface IBookingService
{
/// <summary>Shared cancel+refund core -- see BookingService.CancelBookingCore.</summary>
Task CancelBookingCore(Booking booking);
/// <summary>Logged-in member books a session against their own plan's allowance.</summary>
Task<object> CreateMemberBooking(object payload, HttpContext httpContext);
/// <summary>No membership at all -- pay-per-session, identity proof is the returned OTP.</summary>
Task<object> CreateGuestBooking(object payload, HttpContext httpContext);
/// <summary>Member books a WalkIn-mode facility directly for an arbitrary time window, no
/// pre-created session.</summary>
Task<object> CreateMemberWalkInBooking(object payload, HttpContext httpContext);
/// <summary>Guest/staff walk-in books a WalkIn-mode facility directly.</summary>
Task<object> CreateGuestWalkInBooking(object payload, HttpContext httpContext);
/// <summary>Renders the public, unauthenticated confirmation page a booking's ShareUrl
/// points to -- the "copy the link and share it" receipt. Returns null if not found, so
/// the controller can render a 404 page instead of a JSON error for a browser hit.</summary>
Task<object?> GetBookingView(object payload);
/// <summary>Staff records a guest booking's payment (cash/bank/at-venue) after the fact.</summary>
Task<object> MarkGuestBookingPaid(object payload, HttpContext httpContext);
/// <summary>Staff/door check-in: verifies the OTP, optionally assigns an RFID tag, marks
/// the booking checked in. Also lazily sweeps this client's overdue bookings first (see
/// BookingService.SweepOverdueBookingsAsync) instead of a background job.</summary>
Task<object> CheckInBooking(object payload, HttpContext httpContext);
Task<object> CancelBooking(object payload, HttpContext httpContext);
/// <summary>Staff hands a Confirmed guest booking to a different person (name/phone) --
/// no cancel/recreate needed. Guest bookings only.</summary>
Task<object> ReassignBooking(object payload, HttpContext httpContext);
/// <summary>Staff moves a Confirmed booking to a different time (WalkIn) or session
/// (Scheduled), only onto a slot with room.</summary>
Task<object> RescheduleBooking(object payload, HttpContext httpContext);
/// <summary>Staff manually flags a Confirmed, never-arrived booking.</summary>
Task<object> MarkNoShow(object payload, HttpContext httpContext);
/// <summary>Staff checks out a CheckedIn booking, releasing its RFID tag if any. A guest
/// booking still Unpaid must confirm payment in this same call -- see
/// BookingService.CompleteBooking. Also lazily sweeps this client's overdue Confirmed
/// bookings to NoShow first, same as CheckInBooking.</summary>
Task<object> CompleteBooking(object payload, HttpContext httpContext);
Task<object> GetMyBookings(object payload, HttpContext httpContext);
Task<object> GetSessionBookings(object payload, HttpContext httpContext);
/// <summary>Unified roster covering both booking modes.</summary>
Task<object> GetBookings(object payload, HttpContext httpContext);
/// <summary>Receipts generated whenever a booking's payment is recorded -- their own
/// "Invoices" tab, separate from the membership-based Customer Payments view.</summary>
Task<object> GetBookingInvoices(object payload, HttpContext httpContext);
/// <summary>Renders the public, unauthenticated receipt page a BookingInvoice's ShareUrl
/// points to. Returns null if not found.</summary>
Task<object?> GetBookingInvoiceView(object payload);
/// <summary>Stat-card summary for the Bookings page's Dashboard tab.</summary>
Task<object> GetBookingDashboardSummary(object payload, HttpContext httpContext);
}
}