import { RewardLedgerEntry } from '../aggregates/reward-ledger-entry/reward-ledger-entry.aggregate';
import { RewardStatus } from '../value-objects/reward-status.enum';
import { RightType } from '../value-objects/right-type.enum';

export interface IRewardLedgerEntryRepository {
  save(entry: RewardLedgerEntry): Promise<void>;
  saveAll(entries: RewardLedgerEntry[]): Promise<void>;
  findById(entryId: bigint): Promise<RewardLedgerEntry | null>;
  findByUserId(
    userId: bigint,
    filters?: {
      status?: RewardStatus;
      rightType?: RightType;
      startDate?: Date;
      endDate?: Date;
    },
    pagination?: { page: number; pageSize: number },
  ): Promise<RewardLedgerEntry[]>;
  findByAccountSequence(
    accountSequence: string,
    filters?: {
      status?: RewardStatus;
      rightType?: RightType;
      startDate?: Date;
      endDate?: Date;
    },
    pagination?: { page: number; pageSize: number },
  ): Promise<RewardLedgerEntry[]>;
  findPendingByUserId(userId: bigint): Promise<RewardLedgerEntry[]>;
  findPendingByAccountSequence(accountSequence: string): Promise<RewardLedgerEntry[]>;
  findSettleableByUserId(userId: bigint): Promise<RewardLedgerEntry[]>;
  findSettleableByAccountSequence(accountSequence: string): Promise<RewardLedgerEntry[]>;
  findExpiredPending(beforeDate: Date): Promise<RewardLedgerEntry[]>;
  findBySourceOrderNo(sourceOrderNo: string): Promise<RewardLedgerEntry[]>;
  countByUserId(userId: bigint, status?: RewardStatus): Promise<number>;
  countByAccountSequence(accountSequence: string, status?: RewardStatus): Promise<number>;
}

export const REWARD_LEDGER_ENTRY_REPOSITORY = Symbol('IRewardLedgerEntryRepository');
