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

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

public class NotificaAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertNotificaAllPropertiesEquals(Notifica expected, Notifica actual) {
        assertNotificaAutoGeneratedPropertiesEquals(expected, actual);
        assertNotificaAllUpdatablePropertiesEquals(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 assertNotificaAllUpdatablePropertiesEquals(Notifica expected, Notifica actual) {
        assertNotificaUpdatableFieldsEquals(expected, actual);
        assertNotificaUpdatableRelationshipsEquals(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 assertNotificaAutoGeneratedPropertiesEquals(Notifica expected, Notifica actual) {
        assertThat(actual)
            .as("Verify Notifica 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 assertNotificaUpdatableFieldsEquals(Notifica expected, Notifica actual) {
        assertThat(actual)
            .as("Verify Notifica relevant properties")
            .satisfies(a -> assertThat(a.getTipoCanale()).as("check tipoCanale").isEqualTo(expected.getTipoCanale()))
            .satisfies(a -> assertThat(a.getTipoEvento()).as("check tipoEvento").isEqualTo(expected.getTipoEvento()))
            .satisfies(a -> assertThat(a.getMessaggio()).as("check messaggio").isEqualTo(expected.getMessaggio()))
            .satisfies(a -> assertThat(a.getInviata()).as("check inviata").isEqualTo(expected.getInviata()))
            .satisfies(a -> assertThat(a.getInviataAt()).as("check inviataAt").isEqualTo(expected.getInviataAt()))
            .satisfies(a -> assertThat(a.getErrore()).as("check errore").isEqualTo(expected.getErrore()))
            .satisfies(a -> assertThat(a.getCreatedAt()).as("check createdAt").isEqualTo(expected.getCreatedAt()));
    }

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