package dev.lions.unionflow.server.entity;

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

import java.time.LocalDateTime;
import java.util.UUID;

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

@DisplayName("Suggestion")
class SuggestionTest {

    @Test
    @DisplayName("getters/setters")
    void gettersSetters() {
        Suggestion s = new Suggestion();
        s.setUtilisateurId(UUID.randomUUID());
        s.setUtilisateurNom("User");
        s.setTitre("Titre");
        s.setDescription("Desc");
        s.setCategorie("FEATURE");
        s.setStatut("NOUVELLE");
        s.setNbVotes(5);
        s.setDateSoumission(LocalDateTime.now());

        assertThat(s.getTitre()).isEqualTo("Titre");
        assertThat(s.getCategorie()).isEqualTo("FEATURE");
        assertThat(s.getStatut()).isEqualTo("NOUVELLE");
        assertThat(s.getNbVotes()).isEqualTo(5);
    }

    @Test
    @DisplayName("equals et hashCode")
    void equalsHashCode() {
        UUID id = UUID.randomUUID();
        UUID userId = UUID.randomUUID();
        Suggestion a = new Suggestion();
        a.setId(id);
        a.setUtilisateurId(userId);
        a.setTitre("T");
        Suggestion b = new Suggestion();
        b.setId(id);
        b.setUtilisateurId(userId);
        b.setTitre("T");
        assertThat(a).isEqualTo(b);
        assertThat(a.hashCode()).isEqualTo(b.hashCode());
    }

    @Test
    @DisplayName("toString non null")
    void toString_nonNull() {
        Suggestion s = new Suggestion();
        s.setUtilisateurId(UUID.randomUUID());
        s.setTitre("T");
        assertThat(s.toString()).isNotNull().isNotEmpty();
    }
}
