package com.oguerreiro.resilient.domain;

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

public class UnitTypeAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertUnitTypeAllPropertiesEquals(UnitType expected, UnitType actual) {
        assertUnitTypeAutoGeneratedPropertiesEquals(expected, actual);
        assertUnitTypeAllUpdatablePropertiesEquals(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 assertUnitTypeAllUpdatablePropertiesEquals(UnitType expected, UnitType actual) {
        assertUnitTypeUpdatableFieldsEquals(expected, actual);
        assertUnitTypeUpdatableRelationshipsEquals(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 assertUnitTypeAutoGeneratedPropertiesEquals(UnitType expected, UnitType actual) {
        assertThat(expected)
            .as("Verify UnitType 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 assertUnitTypeUpdatableFieldsEquals(UnitType expected, UnitType actual) {
        assertThat(expected)
            .as("Verify UnitType relevant properties")
            .satisfies(e -> assertThat(e.getName()).as("check name").isEqualTo(actual.getName()))
            .satisfies(e -> assertThat(e.getDescription()).as("check description").isEqualTo(actual.getDescription()))
            .satisfies(e -> assertThat(e.getValueType()).as("check valueType").isEqualTo(actual.getValueType()))
            .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 assertUnitTypeUpdatableRelationshipsEquals(UnitType expected, UnitType actual) {}
}
