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

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

public class DisponibilitaAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertDisponibilitaAllPropertiesEquals(Disponibilita expected, Disponibilita actual) {
        assertDisponibilitaAutoGeneratedPropertiesEquals(expected, actual);
        assertDisponibilitaAllUpdatablePropertiesEquals(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 assertDisponibilitaAllUpdatablePropertiesEquals(Disponibilita expected, Disponibilita actual) {
        assertDisponibilitaUpdatableFieldsEquals(expected, actual);
        assertDisponibilitaUpdatableRelationshipsEquals(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 assertDisponibilitaAutoGeneratedPropertiesEquals(Disponibilita expected, Disponibilita actual) {
        assertThat(actual)
            .as("Verify Disponibilita 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 assertDisponibilitaUpdatableFieldsEquals(Disponibilita expected, Disponibilita actual) {
        assertThat(actual)
            .as("Verify Disponibilita relevant properties")
            .satisfies(a -> assertThat(a.getGiornoSettimana()).as("check giornoSettimana").isEqualTo(expected.getGiornoSettimana()))
            .satisfies(a -> assertThat(a.getDataSpecifica()).as("check dataSpecifica").isEqualTo(expected.getDataSpecifica()))
            .satisfies(a -> assertThat(a.getOraInizio()).as("check oraInizio").isEqualTo(expected.getOraInizio()))
            .satisfies(a -> assertThat(a.getOraFine()).as("check oraFine").isEqualTo(expected.getOraFine()))
            .satisfies(a -> assertThat(a.getOrarioInizio()).as("check orarioInizio").isEqualTo(expected.getOrarioInizio()))
            .satisfies(a -> assertThat(a.getOrarioFine()).as("check orarioFine").isEqualTo(expected.getOrarioFine()))
            .satisfies(a -> assertThat(a.getTipo()).as("check tipo").isEqualTo(expected.getTipo()))
            .satisfies(a -> assertThat(a.getNote()).as("check note").isEqualTo(expected.getNote()));
    }

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