package dev.lions.unionflow.server.security;

import org.junit.jupiter.api.Test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

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

class RoleConstantTest {

    @Test
    void superAdmin_hasExpectedValue() {
        assertThat(RoleConstant.SUPER_ADMIN).isEqualTo("SUPER_ADMIN");
    }

    @Test
    void admin_hasExpectedValue() {
        assertThat(RoleConstant.ADMIN).isEqualTo("ADMIN");
    }

    @Test
    void membre_hasExpectedValue() {
        assertThat(RoleConstant.MEMBRE).isEqualTo("MEMBRE");
    }

    @Test
    void tresorier_hasExpectedValue() {
        assertThat(RoleConstant.TRESORIER).isEqualTo("TRESORIER");
    }

    @Test
    void secretaire_hasExpectedValue() {
        assertThat(RoleConstant.SECRETAIRE).isEqualTo("SECRETAIRE");
    }

    @Test
    void adminOrganisation_hasExpectedValue() {
        assertThat(RoleConstant.ADMIN_ORGANISATION).isEqualTo("ADMIN_ORGANISATION");
    }

    @Test
    void president_hasExpectedValue() {
        assertThat(RoleConstant.PRESIDENT).isEqualTo("PRESIDENT");
    }

    @Test
    void vicePresident_hasExpectedValue() {
        assertThat(RoleConstant.VICE_PRESIDENT).isEqualTo("VICE_PRESIDENT");
    }

    @Test
    void moderateur_hasExpectedValue() {
        assertThat(RoleConstant.MODERATEUR).isEqualTo("MODERATEUR");
    }

    @Test
    void user_hasExpectedValue() {
        assertThat(RoleConstant.USER).isEqualTo("USER");
    }

    @Test
    void organisateurEvenement_hasExpectedValue() {
        assertThat(RoleConstant.ORGANISATEUR_EVENEMENT).isEqualTo("ORGANISATEUR_EVENEMENT");
    }

    @Test
    void specializedRoles_haveExpectedValues() {
        assertThat(RoleConstant.TONTINE_RESP).isEqualTo("TONTINE_RESP");
        assertThat(RoleConstant.MUTUELLE_RESP).isEqualTo("MUTUELLE_RESP");
        assertThat(RoleConstant.VOTE_RESP).isEqualTo("VOTE_RESP");
        assertThat(RoleConstant.COOP_RESP).isEqualTo("COOP_RESP");
        assertThat(RoleConstant.ONG_RESP).isEqualTo("ONG_RESP");
        assertThat(RoleConstant.CULTE_RESP).isEqualTo("CULTE_RESP");
        assertThat(RoleConstant.REGISTRE_RESP).isEqualTo("REGISTRE_RESP");
        assertThat(RoleConstant.AGRI_RESP).isEqualTo("AGRI_RESP");
        assertThat(RoleConstant.COLLECTE_RESP).isEqualTo("COLLECTE_RESP");
    }

    @Test
    void privateConstructor_isCoverable() throws Exception {
        Constructor<RoleConstant> constructor = RoleConstant.class.getDeclaredConstructor();
        constructor.setAccessible(true);
        assertThatCode(constructor::newInstance).doesNotThrowAnyException();
    }
}
