package com.oguerreiro.resilient.domain;

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

public class InputDataUploadAsserts {

  /**
   * Asserts that the entity has all properties (fields/relationships) set.
   *
   * @param expected the expected entity
   * @param actual   the actual entity
   */
  public static void assertInputDataUploadAllPropertiesEquals(InputDataUpload expected, InputDataUpload actual) {
    assertInputDataUploadAutoGeneratedPropertiesEquals(expected, actual);
    assertInputDataUploadAllUpdatablePropertiesEquals(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 assertInputDataUploadAllUpdatablePropertiesEquals(InputDataUpload expected,
      InputDataUpload actual) {
    assertInputDataUploadUpdatableFieldsEquals(expected, actual);
    assertInputDataUploadUpdatableRelationshipsEquals(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 assertInputDataUploadAutoGeneratedPropertiesEquals(InputDataUpload expected,
      InputDataUpload actual) {
    assertThat(expected).as("Verify InputDataUpload 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 assertInputDataUploadUpdatableFieldsEquals(InputDataUpload expected, InputDataUpload actual) {
    assertThat(expected).as("Verify InputDataUpload relevant properties")
        .satisfies(e -> assertThat(e.getTitle()).as("check title").isEqualTo(actual.getTitle()))
        .satisfies(e -> assertThat(e.getDataFile()).as("check dataFile").isEqualTo(actual.getDataFile()))
        .satisfies(e -> assertThat(e.getDataFileContentType()).as("check dataFile contenty type")
            .isEqualTo(actual.getDataFileContentType()))
        .satisfies(
            e -> assertThat(e.getUploadFileName()).as("check uploadFileName").isEqualTo(actual.getUploadFileName()))
        .satisfies(e -> assertThat(e.getDiskFileName()).as("check diskFileName").isEqualTo(actual.getDiskFileName()))
        .satisfies(e -> assertThat(e.getType()).as("check type").isEqualTo(actual.getType()))
        .satisfies(e -> assertThat(e.getState()).as("check state").isEqualTo(actual.getState()))
        .satisfies(e -> assertThat(e.getComments()).as("check comments").isEqualTo(actual.getComments()))
        .satisfies(e -> assertThat(e.getCreationDate()).as("check creationDate").isEqualTo(actual.getCreationDate()))
        .satisfies(e -> assertThat(e.getCreationUsername()).as("check creationUsername")
            .isEqualTo(actual.getCreationUsername()))
        .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 assertInputDataUploadUpdatableRelationshipsEquals(InputDataUpload expected,
      InputDataUpload actual) {
    assertThat(expected).as("Verify InputDataUpload relationships")
        .satisfies(e -> assertThat(e.getPeriod()).as("check period").isEqualTo(actual.getPeriod()))
        .satisfies(e -> assertThat(e.getOwner()).as("check owner").isEqualTo(actual.getOwner()));
  }
}
