import { BaseMatcher } from "../BaseMatcher.js";
import { Matcher } from "../Matcher.js";

/**
 * @template T
 */
export class IsNot extends BaseMatcher {
    /**
     * @type {Matcher<T>}
     */
    #matcher

    /**
     *
     * @param {Matcher<T>} matcher
     */
    constructor(matcher) {
        super();
        this.#matcher = matcher;
    }

    matches(item, mismatch_description) {
        return !this.#matcher.matches(item, mismatch_description);
    }

    describeTo(description) {
        description.appendText('not ').appendDescriptionOf(this.#matcher);
    }
}
