package com.oguerreiro.resilient.domain;

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

public class VariableUnitsAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertVariableUnitsAllPropertiesEquals(VariableUnits expected, VariableUnits actual) {
        assertVariableUnitsAutoGeneratedPropertiesEquals(expected, actual);
        assertVariableUnitsAllUpdatablePropertiesEquals(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 assertVariableUnitsAllUpdatablePropertiesEquals(VariableUnits expected, VariableUnits actual) {
        assertVariableUnitsUpdatableFieldsEquals(expected, actual);
        assertVariableUnitsUpdatableRelationshipsEquals(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 assertVariableUnitsAutoGeneratedPropertiesEquals(VariableUnits expected, VariableUnits actual) {
        assertThat(expected)
            .as("Verify VariableUnits auto generated properties")
            .satisfies(e -> assertThat(e.getId()).as("check id").isEqualTo(actual.getId()));
    }

    /**
     * Asserts that the entity has all the updatable fields set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertVariableUnitsUpdatableFieldsEquals(VariableUnits expected, VariableUnits actual) {
        assertThat(expected)
            .as("Verify VariableUnits relevant properties")
            .satisfies(e -> assertThat(e.getVersion()).as("check version").isEqualTo(actual.getVersion()));
    }

    /**
     * Asserts that the entity has all the updatable relationships set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertVariableUnitsUpdatableRelationshipsEquals(VariableUnits expected, VariableUnits actual) {
        assertThat(expected)
            .as("Verify VariableUnits relationships")
            .satisfies(e -> assertThat(e.getVariable()).as("check variable").isEqualTo(actual.getVariable()))
            .satisfies(e -> assertThat(e.getUnit()).as("check unit").isEqualTo(actual.getUnit()));
    }
}
