package dev.lions.user.manager.enums.audit;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Tests unitaires pour TypeActionAudit
 */
class TypeActionAuditTest {

    @Test
    void testValues() {
        TypeActionAudit[] values = TypeActionAudit.values();

        assertNotNull(values);
        assertTrue(values.length > 0);
    }

    @Test
    void testValueOf() {
        TypeActionAudit userCreate = TypeActionAudit.valueOf("USER_CREATE");
        TypeActionAudit userUpdate = TypeActionAudit.valueOf("USER_UPDATE");
        TypeActionAudit userDelete = TypeActionAudit.valueOf("USER_DELETE");
        TypeActionAudit roleCreate = TypeActionAudit.valueOf("ROLE_CREATE");
        TypeActionAudit roleUpdate = TypeActionAudit.valueOf("ROLE_UPDATE");
        TypeActionAudit roleDelete = TypeActionAudit.valueOf("ROLE_DELETE");
        TypeActionAudit roleAssign = TypeActionAudit.valueOf("ROLE_ASSIGN");
        TypeActionAudit roleRevoke = TypeActionAudit.valueOf("ROLE_REVOKE");

        assertEquals(TypeActionAudit.USER_CREATE, userCreate);
        assertEquals(TypeActionAudit.USER_UPDATE, userUpdate);
        assertEquals(TypeActionAudit.USER_DELETE, userDelete);
        assertEquals(TypeActionAudit.ROLE_CREATE, roleCreate);
        assertEquals(TypeActionAudit.ROLE_UPDATE, roleUpdate);
        assertEquals(TypeActionAudit.ROLE_DELETE, roleDelete);
        assertEquals(TypeActionAudit.ROLE_ASSIGN, roleAssign);
        assertEquals(TypeActionAudit.ROLE_REVOKE, roleRevoke);
    }

    @Test
    void testValueOf_Invalid() {
        assertThrows(IllegalArgumentException.class, () -> {
            TypeActionAudit.valueOf("INVALID");
        });
    }

    @Test
    void testEnumValues() {
        assertNotNull(TypeActionAudit.USER_CREATE);
        assertNotNull(TypeActionAudit.USER_UPDATE);
        assertNotNull(TypeActionAudit.USER_DELETE);
        assertNotNull(TypeActionAudit.ROLE_CREATE);
        assertNotNull(TypeActionAudit.ROLE_UPDATE);
        assertNotNull(TypeActionAudit.ROLE_DELETE);
        assertNotNull(TypeActionAudit.ROLE_ASSIGN);
        assertNotNull(TypeActionAudit.ROLE_REVOKE);
    }
}
