package org.nzbhydra.historystats.stats;

import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.Assertions;
import org.assertj.core.util.Objects;

/**
 * Abstract base class for {@link SuccessfulDownloadsPerIndexer} specific assertions - Generated by CustomAssertionGenerator.
 */
@jakarta.annotation.Generated(value = "assertj-assertions-generator")
public abstract class AbstractSuccessfulDownloadsPerIndexerAssert<S extends AbstractSuccessfulDownloadsPerIndexerAssert<S, A>, A extends SuccessfulDownloadsPerIndexer> extends AbstractObjectAssert<S, A> {

    /**
     * Creates a new <code>{@link AbstractSuccessfulDownloadsPerIndexerAssert}</code> to make assertions on actual SuccessfulDownloadsPerIndexer.
     *
     * @param actual the SuccessfulDownloadsPerIndexer we want to make assertions on.
     */
    protected AbstractSuccessfulDownloadsPerIndexerAssert(A actual, Class<S> selfType) {
        super(actual, selfType);
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's countAll is equal to the given one.
     *
     * @param countAll the given countAll to compare the actual SuccessfulDownloadsPerIndexer's countAll to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's countAll is not equal to the given one.
     */
    public S hasCountAll(int countAll) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting countAll of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // check
        int actualCountAll = actual.getCountAll();
        if (actualCountAll != countAll) {
            failWithMessage(assertjErrorMessage, actual, countAll, actualCountAll);
        }

        // return the current assertion for method chaining
        return myself;
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's countError is equal to the given one.
     *
     * @param countError the given countError to compare the actual SuccessfulDownloadsPerIndexer's countError to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's countError is not equal to the given one.
     */
    public S hasCountError(int countError) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting countError of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // check
        int actualCountError = actual.getCountError();
        if (actualCountError != countError) {
            failWithMessage(assertjErrorMessage, actual, countError, actualCountError);
        }

        // return the current assertion for method chaining
        return myself;
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's countSuccessful is equal to the given one.
     *
     * @param countSuccessful the given countSuccessful to compare the actual SuccessfulDownloadsPerIndexer's countSuccessful to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's countSuccessful is not equal to the given one.
     */
    public S hasCountSuccessful(int countSuccessful) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting countSuccessful of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // check
        int actualCountSuccessful = actual.getCountSuccessful();
        if (actualCountSuccessful != countSuccessful) {
            failWithMessage(assertjErrorMessage, actual, countSuccessful, actualCountSuccessful);
        }

        // return the current assertion for method chaining
        return myself;
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's indexerName is equal to the given one.
     *
     * @param indexerName the given indexerName to compare the actual SuccessfulDownloadsPerIndexer's indexerName to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's indexerName is not equal to the given one.
     */
    public S hasIndexerName(String indexerName) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting indexerName of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // null safe check
        String actualIndexerName = actual.getIndexerName();
        if (!Objects.areEqual(actualIndexerName, indexerName)) {
            failWithMessage(assertjErrorMessage, actual, indexerName, actualIndexerName);
        }

        // return the current assertion for method chaining
        return myself;
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's percentSuccessful is equal to the given one.
     *
     * @param percentSuccessful the given percentSuccessful to compare the actual SuccessfulDownloadsPerIndexer's percentSuccessful to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's percentSuccessful is not equal to the given one.
     */
    public S hasPercentSuccessful(Float percentSuccessful) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting percentSuccessful of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // null safe check
        Float actualPercentSuccessful = actual.getPercentSuccessful();
        if (!Objects.areEqual(actualPercentSuccessful, percentSuccessful)) {
            failWithMessage(assertjErrorMessage, actual, percentSuccessful, actualPercentSuccessful);
        }

        // return the current assertion for method chaining
        return myself;
    }

    /**
     * Verifies that the actual SuccessfulDownloadsPerIndexer's percentSuccessful is close to the given value by less than the given offset.
     * <p>
     * If difference is equal to the offset value, assertion is considered successful.
     *
     * @param percentSuccessful the value to compare the actual SuccessfulDownloadsPerIndexer's percentSuccessful to.
     * @param assertjOffset     the given offset.
     * @return this assertion object.
     * @throws AssertionError - if the actual SuccessfulDownloadsPerIndexer's percentSuccessful is not close enough to the given value.
     */
    public S hasPercentSuccessfulCloseTo(Float percentSuccessful, Float assertjOffset) {
        // check that actual SuccessfulDownloadsPerIndexer we want to make assertions on is not null.
        isNotNull();

        Float actualPercentSuccessful = actual.getPercentSuccessful();

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = String.format("\nExpecting percentSuccessful:\n  <%s>\nto be close to:\n  <%s>\nby less than <%s> but difference was <%s>",
            actualPercentSuccessful, percentSuccessful, assertjOffset, Math.abs(percentSuccessful - actualPercentSuccessful));

        // check
        Assertions.assertThat(actualPercentSuccessful).overridingErrorMessage(assertjErrorMessage).isCloseTo(percentSuccessful, Assertions.within(assertjOffset));

        // return the current assertion for method chaining
        return myself;
    }

}
