package com.oguerreiro.resilient.domain;

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

public class VariableClassAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertVariableClassAllPropertiesEquals(VariableClass expected, VariableClass actual) {
        assertVariableClassAutoGeneratedPropertiesEquals(expected, actual);
        assertVariableClassAllUpdatablePropertiesEquals(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 assertVariableClassAllUpdatablePropertiesEquals(VariableClass expected, VariableClass actual) {
        assertVariableClassUpdatableFieldsEquals(expected, actual);
        assertVariableClassUpdatableRelationshipsEquals(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 assertVariableClassAutoGeneratedPropertiesEquals(VariableClass expected, VariableClass actual) {
        assertThat(expected)
            .as("Verify VariableClass 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 assertVariableClassUpdatableFieldsEquals(VariableClass expected, VariableClass actual) {
        assertThat(expected)
            .as("Verify VariableClass relevant properties")
            .satisfies(e -> assertThat(e.getCode()).as("check code").isEqualTo(actual.getCode()))
            .satisfies(e -> assertThat(e.getName()).as("check name").isEqualTo(actual.getName()))
            .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 assertVariableClassUpdatableRelationshipsEquals(VariableClass expected, VariableClass actual) {
        assertThat(expected)
            .as("Verify VariableClass relationships")
            .satisfies(e -> assertThat(e.getVariableClassType()).as("check variable class type").isEqualTo(actual.getVariableClassType()));
    }
}
