package org.nzbhydra.mapping.newznab.xml;

import org.assertj.core.util.Objects;
import org.nzbhydra.mapping.newznab.AbstractNewznabResponseAssert;

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

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

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

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

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

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

    /**
     * Verifies that the actual Xml's searchType is equal to the given one.
     *
     * @param searchType the given searchType to compare the actual Xml's searchType to.
     * @return this assertion object.
     * @throws AssertionError - if the actual Xml's searchType is not equal to the given one.
     */
    public S hasSearchType(org.nzbhydra.mapping.newznab.NewznabResponse.SearchType searchType) {
        // check that actual Xml we want to make assertions on is not null.
        isNotNull();

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

        // null safe check
        org.nzbhydra.mapping.newznab.NewznabResponse.SearchType actualSearchType = actual.getSearchType();
        if (!Objects.areEqual(actualSearchType, searchType)) {
            failWithMessage(assertjErrorMessage, actual, searchType, actualSearchType);
        }

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

}
