package dev.lions.unionflow.server.entity;

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

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

class DeviseTest {

  @Test
  @DisplayName("Devise de référence = XOF")
  void reference() {
    assertThat(Devise.reference()).isEqualTo(Devise.XOF);
  }

  @Test
  @DisplayName("EUR/USD/GBP/CAD/CHF marquées internationales")
  void internationales() {
    assertThat(Devise.EUR.estInternationale()).isTrue();
    assertThat(Devise.USD.estInternationale()).isTrue();
    assertThat(Devise.GBP.estInternationale()).isTrue();
    assertThat(Devise.CAD.estInternationale()).isTrue();
    assertThat(Devise.CHF.estInternationale()).isTrue();
  }

  @Test
  @DisplayName("XOF/XAF non marquées internationales (zones franc CFA)")
  void cfaNonInternationale() {
    assertThat(Devise.XOF.estInternationale()).isFalse();
    assertThat(Devise.XAF.estInternationale()).isFalse();
  }

  @Test
  @DisplayName("Zones cohérentes")
  void zones() {
    assertThat(Devise.XOF.zone()).isEqualTo(Devise.ZoneDevise.UEMOA);
    assertThat(Devise.XAF.zone()).isEqualTo(Devise.ZoneDevise.CEMAC);
    assertThat(Devise.EUR.zone()).isEqualTo(Devise.ZoneDevise.EUROPE);
    assertThat(Devise.USD.zone()).isEqualTo(Devise.ZoneDevise.AMERIQUE);
    assertThat(Devise.GHS.zone()).isEqualTo(Devise.ZoneDevise.CEDEAO);
    assertThat(Devise.MAD.zone()).isEqualTo(Devise.ZoneDevise.MAGHREB);
  }

  @Test
  @DisplayName("Libellés non vides")
  void libelles() {
    for (Devise d : Devise.values()) {
      assertThat(d.libelle()).isNotBlank();
    }
  }
}
