package it.sw.pa.comune.artegna.domain;

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

public class MessaggioAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertMessaggioAllPropertiesEquals(Messaggio expected, Messaggio actual) {
        assertMessaggioAutoGeneratedPropertiesEquals(expected, actual);
        assertMessaggioAllUpdatablePropertiesEquals(expected, actual);
    }

    /**
     * Asserts that the entity has all updatable properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertMessaggioAllUpdatablePropertiesEquals(Messaggio expected, Messaggio actual) {
        assertMessaggioUpdatableFieldsEquals(expected, actual);
        assertMessaggioUpdatableRelationshipsEquals(expected, actual);
    }

    /**
     * Asserts that the entity has all the auto generated properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertMessaggioAutoGeneratedPropertiesEquals(Messaggio expected, Messaggio actual) {
        assertThat(actual)
            .as("Verify Messaggio auto generated properties")
            .satisfies(a -> assertThat(a.getId()).as("check id").isEqualTo(expected.getId()));
    }

    /**
     * Asserts that the entity has all the updatable fields set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertMessaggioUpdatableFieldsEquals(Messaggio expected, Messaggio actual) {
        assertThat(actual)
            .as("Verify Messaggio relevant properties")
            .satisfies(a -> assertThat(a.getSpedito()).as("check spedito").isEqualTo(expected.getSpedito()))
            .satisfies(a -> assertThat(a.getTesto()).as("check testo").isEqualTo(expected.getTesto()))
            .satisfies(a -> assertThat(a.getLetto()).as("check letto").isEqualTo(expected.getLetto()));
    }

    /**
     * Asserts that the entity has all the updatable relationships set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertMessaggioUpdatableRelationshipsEquals(Messaggio expected, Messaggio actual) {
        assertThat(actual)
            .as("Verify Messaggio relationships")
            .satisfies(a -> assertThat(a.getUtente()).as("check utente").isEqualTo(expected.getUtente()));
    }
}
