using System.Data.Common; using EntitlementDAL.DTOs; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; namespace EntitlementDAL.Interfaces; public interface ISubscriptionDAL { Task GetByIdAsync(int subscriptionId, LoginDTO login, CancellationToken ct); Task GetByClientAsync(int clientId, LoginDTO login, CancellationToken ct); Task GetByEngagementRefAsync(string idmsEngagementRef, LoginDTO login, CancellationToken ct); /// Entitlement↔Payment loose coupling (§9.1) — resolves which subscription a bare /// PayOrderId belongs to (PAY's own "payorder.statuschanged" event carries no SourceDocId). Task GetByPayOrderIdAsync(int payOrderId, LoginDTO login, CancellationToken ct); Task> GetListPagedAsync( int subscriptionStatus, int planId, int clientId, int offset, int pageSize, LoginDTO login, CancellationToken ct); Task SaveAsync(SubscriptionDTO dto, LoginDTO login, DbTransaction tx, CancellationToken ct); Task UpdateAsync(SubscriptionDTO dto, LoginDTO login, DbTransaction tx, CancellationToken ct); Task UpdatePlanAsync(int subscriptionId, int planId, LoginDTO login, DbTransaction tx, CancellationToken ct); Task UpdateRenewalAsync(int subscriptionId, DateTime newValidTill, LoginDTO login, DbTransaction tx, CancellationToken ct); Task UpdateStatusAsync(int subscriptionId, byte status, LoginDTO login, DbTransaction tx, CancellationToken ct); Task UpdateClientSubscriptionStatusAsync(int clientId, byte status, LoginDTO login, DbTransaction tx, CancellationToken ct); /// Entitlement↔Payment loose coupling (§9.1) — records the current/most-recent /// outstanding PayOrderId for this subscription. Deliberately NOT a history/ledger — PAY's /// own TPAYORDER (queryable by SourceDocType+SourceDocId) is the real transactional history; /// this is only "what am I currently waiting on," for the Dapr subscriber and reconciliation /// job. No transaction parameter — called standalone, right after InitiatePayOrder succeeds. Task UpdatePayOrderIdAsync(int subscriptionId, int? payOrderId, LoginDTO login, CancellationToken ct); /// Reconciliation job's own scan (§9.1 item 4) — every Pending subscription with /// a real outstanding PayOrderId, across all tenants. Task> GetPendingWithPayOrderAsync(LoginDTO login, CancellationToken ct); }