import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { ReconciliationRecord, Refund, Settlement } from '../models/reconciliation.model';
import { FinanceGateway } from './finance-gateway.interface';

/**
 * Seeded empty. AdminOrdersLocalGateway's requestRefund(id) exists as a mock
 * method but nothing reads it into a real Refund/reconciliation flow yet -
 * this gateway is the real target once docs/backend/
 * PHASE-7-PAYMENTS-RECONCILIATION-CONTRACT.md ships.
 */
@Injectable({ providedIn: 'root' })
export class FinanceLocalGateway implements FinanceGateway {
  private reconciliation: ReconciliationRecord[] = [];

  loadRefunds(_orderId?: string): Observable<Refund[]> {
    return of([]);
  }

  loadReconciliationQueue(): Observable<ReconciliationRecord[]> {
    return of(this.reconciliation);
  }

  resolveReconciliation(id: string, _note: string): Observable<void> {
    this.reconciliation = this.reconciliation.filter(r => r.id !== id);
    return of(void 0);
  }

  loadSettlements(_sellerId?: string): Observable<Settlement[]> {
    return of([]);
  }
}
