import { Settlement, SettlementStatus } from '../entities/settlement.entity';
import { JournalEntry } from '../entities/journal-entry.entity';

export const SETTLEMENT_REPOSITORY = Symbol('ISettlementRepository');

export interface ISettlementRepository {
  findById(id: string): Promise<Settlement | null>;
  findByTradeId(tradeId: string): Promise<Settlement | null>;
  findAndCount(options: {
    status?: SettlementStatus;
    page: number;
    limit: number;
  }): Promise<[Settlement[], number]>;
  save(settlement: Settlement): Promise<Settlement>;
  createSettlementWithJournalEntries(
    settlement: Partial<Settlement>,
    journalEntries: Partial<JournalEntry>[],
  ): Promise<Settlement>;
  /** QueryBuilder-based: stats by status */
  getStatsByStatus(status: SettlementStatus): Promise<{ count: number; total: string }>;
  /** QueryBuilder-based: monthly settlement counts (last 12 months) */
  getMonthlySettlementCounts(): Promise<Array<{ month: string; settlements: number }>>;
}
