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

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

class PispiRtpResponseTest {

  @Test
  @DisplayName("isAccepted true uniquement si status=ACCEPTED")
  void isAccepted() {
    var accepted = new PispiRtpResponse("R1", "ACCEPTED", null, null, null, "TX001");
    assertThat(accepted.isAccepted()).isTrue();
    assertThat(accepted.isRefused()).isFalse();
    assertThat(accepted.isPending()).isFalse();
    assertThat(accepted.isExpired()).isFalse();
  }

  @Test
  @DisplayName("isRefused true uniquement si status=REFUSED")
  void isRefused() {
    var refused = new PispiRtpResponse("R1", "REFUSED", "FOCR", "Compte clôturé", null, null);
    assertThat(refused.isRefused()).isTrue();
    assertThat(refused.isAccepted()).isFalse();
    assertThat(refused.isPending()).isFalse();
    assertThat(refused.isExpired()).isFalse();
  }

  @Test
  @DisplayName("isPending true uniquement si status=PENDING")
  void isPending() {
    var pending = new PispiRtpResponse("R1", "PENDING", null, null, null, null);
    assertThat(pending.isPending()).isTrue();
    assertThat(pending.isAccepted()).isFalse();
  }

  @Test
  @DisplayName("isExpired true uniquement si status=EXPIRED")
  void isExpired() {
    var expired = new PispiRtpResponse("R1", "EXPIRED", null, null, null, null);
    assertThat(expired.isExpired()).isTrue();
    assertThat(expired.isAccepted()).isFalse();
  }

  @Test
  @DisplayName("Tous les helpers false si status null")
  void statusNullAllFalse() {
    var nullStatus = new PispiRtpResponse("R1", null, null, null, null, null);
    assertThat(nullStatus.isAccepted()).isFalse();
    assertThat(nullStatus.isRefused()).isFalse();
    assertThat(nullStatus.isPending()).isFalse();
    assertThat(nullStatus.isExpired()).isFalse();
  }
}
