import { HttpStep } from '../../HttpStep.js';
export const IncludesAssertionKind = 'HttpAction#IncludesAssertion';
/**
 * An assertion that makes sure the input includes the set value.
 */
export class IncludesAssertion extends HttpStep {
    kind = IncludesAssertionKind;
    /**
     * The value to search for.
     */
    value;
    constructor(valueOrInit) {
        super();
        if (typeof valueOrInit === 'object') {
            const typed = valueOrInit;
            this.new(typed);
        }
        else if (typeof valueOrInit === 'string') {
            this.new({
                kind: IncludesAssertionKind,
                value: valueOrInit,
                enabled: true,
            });
        }
    }
    new(init) {
        super.new(init);
        this.kind = IncludesAssertionKind;
        this.value = init.value;
    }
    checkValidity() {
        return !!this.value;
    }
    toJSON() {
        const result = {
            ...super.toJSON(),
            kind: IncludesAssertionKind,
        };
        if (this.value) {
            result.value = this.value;
        }
        return result;
    }
}
//# sourceMappingURL=IncludesAssertion.js.map