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

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

public class StrutturaAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertStrutturaAllPropertiesEquals(Struttura expected, Struttura actual) {
        assertStrutturaAutoGeneratedPropertiesEquals(expected, actual);
        assertStrutturaAllUpdatablePropertiesEquals(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 assertStrutturaAllUpdatablePropertiesEquals(Struttura expected, Struttura actual) {
        assertStrutturaUpdatableFieldsEquals(expected, actual);
        assertStrutturaUpdatableRelationshipsEquals(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 assertStrutturaAutoGeneratedPropertiesEquals(Struttura expected, Struttura actual) {
        assertThat(actual)
            .as("Verify Struttura 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 assertStrutturaUpdatableFieldsEquals(Struttura expected, Struttura actual) {
        assertThat(actual)
            .as("Verify Struttura relevant properties")
            .satisfies(a -> assertThat(a.getNome()).as("check nome").isEqualTo(expected.getNome()))
            .satisfies(a -> assertThat(a.getDescrizione()).as("check descrizione").isEqualTo(expected.getDescrizione()))
            .satisfies(a -> assertThat(a.getIndirizzo()).as("check indirizzo").isEqualTo(expected.getIndirizzo()))
            .satisfies(a -> assertThat(a.getCapienzaMax()).as("check capienzaMax").isEqualTo(expected.getCapienzaMax()))
            .satisfies(a -> assertThat(a.getAttiva()).as("check attiva").isEqualTo(expected.getAttiva()))
            .satisfies(a -> assertThat(a.getFotoUrl()).as("check fotoUrl").isEqualTo(expected.getFotoUrl()))
            .satisfies(a -> assertThat(a.getCreatedAt()).as("check createdAt").isEqualTo(expected.getCreatedAt()))
            .satisfies(a -> assertThat(a.getUpdatedAt()).as("check updatedAt").isEqualTo(expected.getUpdatedAt()));
    }

    /**
     * Asserts that the entity has all the updatable relationships set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertStrutturaUpdatableRelationshipsEquals(Struttura expected, Struttura actual) {
        // empty method
    }
}
