import { Money } from '../../pricing/models/money.model';

/** Per docs/backend/PHASE-7-PAYMENTS-RECONCILIATION-CONTRACT.md §1-3. */
export interface Refund {
  id: string;
  orderId: string;
  orderLineIds: string[];
  amount: Money;
  reason: string;
  actor: string;
  status: 'requested' | 'approved' | 'processing' | 'completed' | 'failed';
  requestedAt: string;
  completedAt?: string;
}

export interface ReconciliationRecord {
  id: string;
  orderId: string;
  providerPaymentId?: string;
  internalAmount: Money;
  providerAmount?: Money;
  matchStrategy: 'provider_payment_id' | 'merchant_reference' | 'amount_currency_fallback';
  result: 'matched' | 'unmatched' | 'duplicate' | 'amount_mismatch' | 'status_mismatch';
  resolvedBy?: string;
  resolvedAt?: string;
}

export interface Settlement {
  id: string;
  sellerId: string;
  periodStart: string;
  periodEnd: string;
  grossAmount: Money;
  commission: Money;
  refunds: Money;
  netPayout: Money;
  status: 'pending' | 'paid';
}
