package dev.lions.unionflow.server.payment.pispi.dto;

import java.time.LocalDateTime;

/**
 * Réponse à un Request To Pay (RTP) — message ISO 20022 {@code pain.014.001} mappé vers la
 * Business API PI-SPI.
 *
 * @since 2026-04-25
 */
public record PispiRtpResponse(
    String rtpId,
    String status,           // ACCEPTED, REFUSED, EXPIRED, PENDING
    String reasonCode,       // code BCEAO si REFUSED (DUPL, FOCR, FRAD, RR01-RR06, etc.)
    String reasonDescription,
    LocalDateTime responseAt,
    String settledTransactionId   // si ACCEPTED → ID de la transaction pacs.008 générée
) {

  public boolean isAccepted() {
    return "ACCEPTED".equals(status);
  }

  public boolean isRefused() {
    return "REFUSED".equals(status);
  }

  public boolean isPending() {
    return "PENDING".equals(status);
  }

  public boolean isExpired() {
    return "EXPIRED".equals(status);
  }
}
