package com.oguerreiro.resilient.domain;

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

public class OrganizationTypeAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertOrganizationTypeAllPropertiesEquals(OrganizationType expected, OrganizationType actual) {
        assertOrganizationTypeAutoGeneratedPropertiesEquals(expected, actual);
        assertOrganizationTypeAllUpdatablePropertiesEquals(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 assertOrganizationTypeAllUpdatablePropertiesEquals(OrganizationType expected, OrganizationType actual) {
        assertOrganizationTypeUpdatableFieldsEquals(expected, actual);
        assertOrganizationTypeUpdatableRelationshipsEquals(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 assertOrganizationTypeAutoGeneratedPropertiesEquals(OrganizationType expected, OrganizationType actual) {
        assertThat(expected)
            .as("Verify OrganizationType 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 assertOrganizationTypeUpdatableFieldsEquals(OrganizationType expected, OrganizationType actual) {
        assertThat(expected)
            .as("Verify OrganizationType 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.getDescription()).as("check description").isEqualTo(actual.getDescription()))
            .satisfies(e -> assertThat(e.getNature()).as("check nature").isEqualTo(actual.getNature()))
            .satisfies(e -> assertThat(e.getIcon()).as("check icon").isEqualTo(actual.getIcon()))
            .satisfies(e -> assertThat(e.getIconContentType()).as("check icon contenty type").isEqualTo(actual.getIconContentType()))
            .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 assertOrganizationTypeUpdatableRelationshipsEquals(OrganizationType expected, OrganizationType actual) {
        assertThat(expected)
            .as("Verify OrganizationType relationships")
            .satisfies(e -> assertThat(e.getMetadataProperties()).as("check metadataProperties").isEqualTo(actual.getMetadataProperties()));
    }
}
