using Fake.Domain.Repositories; using Oms.Domain.MarketingAggregate.Entities; using Oms.Domain.MarketingAggregate.Enums; namespace Oms.Domain.MarketingAggregate.Repositories; public interface ICustomerReferralCodeRepository : IRepository { Task GetByCustomerIdAsync(int customerId, CancellationToken cancellationToken = default); Task GetByInviteCodeAsync(string inviteCode, CancellationToken cancellationToken = default); Task ExistsInviteCodeAsync(string inviteCode, int? excludeId = null, CancellationToken cancellationToken = default); } public interface IMemberPointsRuleRepository : IRepository { Task GetActiveRuleAsync(CancellationToken cancellationToken = default); } public interface ICustomerPointsAccountRepository : IRepository { Task GetByCustomerIdAsync(int customerId, CancellationToken cancellationToken = default); } public interface ICustomerPointsFlowRepository : IRepository { Task ExistsEarnForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default); Task ExistsClawbackForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default); Task GetEarnPointsForOrderAsync(int customerId, int orderId, CancellationToken cancellationToken = default); Task SumPointsSinceAsync(int customerId, DateTime since, CancellationToken cancellationToken = default); } public interface ICouponTemplateRepository : IRepository { Task ExistsTemplateCodeAsync(string templateCode, int? excludeId = null, CancellationToken cancellationToken = default); } public interface ICouponInstanceRepository : IRepository { Task CountByTemplateAndCustomerAsync(int templateId, int customerId, CancellationToken cancellationToken = default); Task> GetAvailableByCustomerAsync(int customerId, CancellationToken cancellationToken = default); Task> GetPendingUnlockByCustomerAsync(int customerId, CancellationToken cancellationToken = default); Task> GetExpiredLocksAsync(DateTime now, int take, CancellationToken cancellationToken = default); Task> GetExpiredAvailableAsync(DateTime now, int take, CancellationToken cancellationToken = default); Task> GetExpiringAvailableAsync(DateTime from, DateTime to, int take, CancellationToken cancellationToken = default); /// /// 当前可用券张数(时点负债)。 /// Task CountAvailableAsync(CancellationToken cancellationToken = default); /// /// 区间内发出的券(ReceiveTime)。 /// Task> ListReceivedInRangeAsync( DateTime startInclusive, DateTime endExclusive, CancellationToken cancellationToken = default); /// /// 区间内核销的券(UseTime + Used)。 /// Task> ListUsedInRangeAsync( DateTime startInclusive, DateTime endExclusive, CancellationToken cancellationToken = default); /// /// 区间内过期的券(Expired + ValidEndTime)。 /// Task> ListExpiredInRangeAsync( DateTime startInclusive, DateTime endExclusive, CancellationToken cancellationToken = default); } public interface IReferralCommissionRuleRepository : IRepository { Task GetActiveRuleAsync(CancellationToken cancellationToken = default); } public interface IReferralCommissionDetailRepository : IRepository { Task GetByOrderAndReferrerAsync(int orderId, int referrerCustomerId, CancellationToken cancellationToken = default); Task GetByOrderIdAsync(int orderId, CancellationToken cancellationToken = default); Task SumByReferrerAsync(int referrerCustomerId, CommissionStatus status, CancellationToken cancellationToken = default); Task SumSettledCommissionInMonthAsync(int referrerCustomerId, int year, int month, CancellationToken cancellationToken = default); Task> GetPendingSettleAsync(DateTime now, int take, CancellationToken cancellationToken = default); Task> ListByReferrerAndRefereesAsync( int referrerCustomerId, int[] refereeIds, CancellationToken cancellationToken = default); } public interface ICommissionWithdrawRequestRepository : IRepository { Task ExistsPendingByCustomerAsync(int customerId, CancellationToken cancellationToken = default); Task ExistsSerialNumberAsync(string serialNumber, CancellationToken cancellationToken = default); } public interface IMarketingAuditLogRepository : IRepository { }