Files
Core_Be/Interfaces/IClientRepository.cs
T
Dhananjaya99 bffc9b1686 first commit
2026-09-28 11:44:26 +05:30

71 lines
4.7 KiB
C#

using Fitness_core_BE.Domain;
using Fitness_core_BE.DTOs.Customer;
using Fitness_core_BE.DTOs.CustomerPlan;
using Fitness_core_BE.DTOs.Meal;
using Fitness_core_BE.DTOs.Workout;
using Fitness_core_BE.Models;
namespace Fitness_core_BE.Interfaces
{
public interface IClientRepository
{
Task<List<Customer>> GetAllCustomers();
Task<Customer?> GetCustomerById(Guid customerId);
Task<List<Client>> GetAllClientsAsync(CancellationToken ct = default);
Task<Client?> GetClientByIdAsync(Guid clientId, CancellationToken ct = default);
Task<List<Customer>> GetClientListAsync(Guid clientId, CancellationToken ct = default);
Task <object> RegisterClientAsync(Client client, CancellationToken ct = default);
Task RegisterBussinessDetailAsync(ClientBusiness clientBusiness, CancellationToken ct = default);
// Tracked (unlike GetClientByIdAsync) so the caller can mutate & persist via UoW.
Task<ClientBusiness?> GetPrimaryBusinessByClientIdAsync(Guid clientId, CancellationToken ct = default);
Task<Client?> GetClientEntityByIdAsync(Guid clientId, CancellationToken ct = default);
Task<List<FollowedPlanDto>> GetFollowedWorkoutPlansAsync(Guid customerId, CancellationToken ct = default);
Task<List<FollowedPlanDto>> GetFollowedMealPlansAsync(Guid customerId, CancellationToken ct = default);
Task<CustomerHealth?> GetCustomerHealthAsync(Guid customerId, CancellationToken ct = default);
Task<List<MemberListRowDto>> GetCustomersByClientIdAsync(Guid clientId, CancellationToken ct = default);
Task<bool> CustomerBelongsToClientAsync(Guid customerId, Guid clientId, CancellationToken ct = default);
Task<List<CustomerPlan>> GetCustomerPlansByClientIdAsync(Guid clientId, CancellationToken ct = default);
// Workout Plan operations
Task<List<WorkoutPlanDto>> GetWorkoutPlansByClientIdAsync(Guid clientId, CancellationToken ct = default);
Task<WorkoutPlanDetailDto?> GetWorkoutPlanByIdForClientAsync(Guid workoutPlanId, Guid clientId, CancellationToken ct = default);
// Meal Plan operations
Task<List<MealPlanDto>> GetMealPlansByClientIdAsync(Guid clientId, CancellationToken ct = default);
Task<MealPlanDetailDto?> GetMealPlanByIdForClientAsync(Guid mealPlanId, Guid clientId, CancellationToken ct = default);
// Customer Plan operations
Task<CustomerPlanDto?> GetCustomerPlanByIdForClientAsync(Guid customerPlanId, Guid clientId, CancellationToken ct = default);
// Full entity (not the DTO above) — needed by CustomerSubscriptionFactory, which reads
// DurationMode/ValidTo/InstallmentCount/HasOnboardingFee that the DTO doesn't carry.
Task<CustomerPlan?> GetCustomerPlanEntityForClientAsync(Guid customerPlanId, Guid clientId, CancellationToken ct = default);
// Change-membership-plan / unassign-membership operations
Task<SubscriptionMember?> GetActiveMembershipForCustomerAsync(Guid customerId, CancellationToken ct = default);
// Deactivates a whole subscription and its members/subitems/installments.
Task DeactivateSubscriptionAsync(Guid subscriptionId, CancellationToken ct = default);
// Deactivates a single member's row within a (possibly still-active) subscription.
Task DeactivateSubscriptionMemberAsync(Guid subscriptionMemberId, CancellationToken ct = default);
// Any membership (assigned or not) for assign/unassign to act on.
Task<SubscriptionMember?> GetMembershipForCustomerAsync(Guid customerId, CancellationToken ct = default);
// Toggles IsPlanAssigned without touching IsActive, so the member stays listed.
Task SetMembershipPlanAssignedAsync(
Guid subscriptionId, bool assigned, bool wholeSubscription, Guid subscriptionMemberId,
CancellationToken ct = default);
// Deactivates oldMembership's subscription (if primary) or just their own row (if not),
// then persists newAggregate as the customer's new subscription.
Task ReplaceCustomerSubscriptionAsync(SubscriptionMember? oldMembership, CustomerSubscriptionAggregate newAggregate, CancellationToken ct = default);
// Client Package operations
Task<List<ClientPackage>> GetPackageListAsync(CancellationToken ct = default);
Task<ClientPackage?> GetPackageByIdAsync(Guid id, CancellationToken ct = default);
Task<List<ClientBusiness>> GetActiveGymsAsync(CancellationToken ct = default);
Task<List<CustomerCards>> GetCardsByClientIdAsync(Guid clientId, CancellationToken ct = default);
Task<List<CustomerCards>> GetCardsByCustomerForClientAsync(Guid customerId, Guid clientId, CancellationToken ct = default);
}
}