package org.nzbhydra.mapping;

import org.assertj.core.api.AbstractComparableAssert;
import org.assertj.core.util.Objects;

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

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

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

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

        // null safe check
        String actualAsString = actual.getAsString();
        if (!Objects.areEqual(actualAsString, asString)) {
            failWithMessage(assertjErrorMessage, actual, asString, actualAsString);
        }

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

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

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

        // check
        int actualMajor = actual.major;
        if (actualMajor != major) {
            failWithMessage(assertjErrorMessage, actual, major, actualMajor);
        }

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

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

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

        // check
        int actualMinor = actual.minor;
        if (actualMinor != minor) {
            failWithMessage(assertjErrorMessage, actual, minor, actualMinor);
        }

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

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

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

        // check
        int actualPatch = actual.patch;
        if (actualPatch != patch) {
            failWithMessage(assertjErrorMessage, actual, patch, actualPatch);
        }

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

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

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

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

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

}
