/* eslint-disable @typescript-eslint/unified-signatures */
import { HttpStep } from '../../HttpStep.js';
export const DeleteCookieStepKind = 'HttpAction#DeleteCookie';
export class DeleteCookieStep extends HttpStep {
    kind = DeleteCookieStepKind;
    /**
     * The URL associated with the cookie. When not set it uses the request URL or the request URL of the last redirect.
     */
    url;
    /**
     * Name of the cookie to remove.
     * When not set it removes all cookies for the URL.
     */
    name;
    /**
     * @param name The name of the cookie
     * @param url Optionally, the URL of the cookie.
     */
    static byName(name, url) {
        return new DeleteCookieStep({
            kind: DeleteCookieStepKind,
            enabled: true,
            name,
            url,
        });
    }
    static byUrl(url) {
        return new DeleteCookieStep({
            kind: DeleteCookieStepKind,
            enabled: true,
            url,
        });
    }
    constructor(init) {
        super();
        if (init) {
            this.new(init);
        }
    }
    new(init) {
        super.new(init);
        this.kind = DeleteCookieStepKind;
        if (init.url) {
            this.url = init.url;
        }
        else {
            this.url = undefined;
        }
        if (init.name) {
            this.name = init.name;
        }
        else {
            this.name = undefined;
        }
    }
    checkValidity() {
        return true;
    }
    toJSON() {
        const result = {
            ...super.toJSON(),
            kind: DeleteCookieStepKind,
        };
        if (this.url) {
            result.url = this.url;
        }
        if (this.name) {
            result.name = this.name;
        }
        return result;
    }
}
//# sourceMappingURL=DeleteCookieStep.js.map