import { HttpStep } from '../../HttpStep.js';
export const NotEqualAssertionKind = 'HttpAction#NotEqualAssertion';
/**
 * An assertion that makes sure the input value is not [strict] equal to the set value.
 */
export class NotEqualAssertion extends HttpStep {
    kind = NotEqualAssertionKind;
    /**
     * The value to compare to.
     * This is always a string. Use the `dataType` to determine the correct data type.
     */
    value;
    /**
     * The data type of the value. This is a value prefixed with
     * `http://www.w3.org/2001/XMLSchema#` or `http://a.ml/vocabularies/shapes#`.
     *
     * Examples:
     *
     * - `http://www.w3.org/2001/XMLSchema#boolean`
     * - `http://www.w3.org/2001/XMLSchema#string`
     * - `http://www.w3.org/2001/XMLSchema#number`
     * - `http://www.w3.org/2001/XMLSchema#integer`
     * - `http://www.w3.org/2001/XMLSchema#long`
     * - `http://a.ml/vocabularies/shapes#number`
     * - `http://a.ml/vocabularies/shapes#integer`
     * - `http://a.ml/vocabularies/shapes#double`
     * - ...
     *
     * @default `http://www.w3.org/2001/XMLSchema#string`
     */
    dataType;
    /**
     * Whether it should check for a value and the data type.
     */
    strict;
    constructor(valueOrInit, strict, dataType) {
        super();
        if (typeof valueOrInit === 'object') {
            const typed = valueOrInit;
            this.new(typed);
        }
        else if (typeof valueOrInit === 'string') {
            this.new({
                kind: NotEqualAssertionKind,
                value: valueOrInit,
                dataType,
                strict,
                enabled: true,
            });
        }
    }
    new(init) {
        super.new(init);
        this.kind = NotEqualAssertionKind;
        this.value = init.value;
        this.dataType = init.dataType;
        this.strict = init.strict;
    }
    checkValidity() {
        return !!this.value;
    }
    toJSON() {
        const result = {
            ...super.toJSON(),
            kind: NotEqualAssertionKind,
        };
        if (this.value) {
            result.value = this.value;
        }
        if (this.dataType) {
            result.dataType = this.dataType;
        }
        if (typeof this.strict === 'boolean') {
            result.strict = this.strict;
        }
        return result;
    }
}
//# sourceMappingURL=NotEqualAssertion.js.map