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

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

public class LiberatoriaAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertLiberatoriaAllPropertiesEquals(Liberatoria expected, Liberatoria actual) {
        assertLiberatoriaAutoGeneratedPropertiesEquals(expected, actual);
        assertLiberatoriaAllUpdatablePropertiesEquals(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 assertLiberatoriaAllUpdatablePropertiesEquals(Liberatoria expected, Liberatoria actual) {
        assertLiberatoriaUpdatableFieldsEquals(expected, actual);
        assertLiberatoriaUpdatableRelationshipsEquals(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 assertLiberatoriaAutoGeneratedPropertiesEquals(Liberatoria expected, Liberatoria actual) {
        assertThat(actual)
            .as("Verify Liberatoria 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 assertLiberatoriaUpdatableFieldsEquals(Liberatoria expected, Liberatoria actual) {
        assertThat(actual)
            .as("Verify Liberatoria relevant properties")
            .satisfies(a -> assertThat(a.getAccettata()).as("check accettata").isEqualTo(expected.getAccettata()));
    }

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