"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.FirewallRulesV4PagePaginationArray = exports.FirewallRulesSinglePage = exports.Rules = void 0;
const resource_1 = require("../../resource.js");
const pagination_1 = require("../../pagination.js");
/**
 * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
 */
class Rules extends resource_1.APIResource {
    /**
     * Create one or more firewall rules.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    create(params, options) {
        const { zone_id, ...body } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesSinglePage, {
            body,
            method: 'post',
            ...options,
        });
    }
    /**
     * Updates an existing firewall rule.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    update(ruleId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.put(`/zones/${zone_id}/firewall/rules/${ruleId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetches firewall rules in a zone. You can filter the results using several
     * optional parameters.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    list(params, options) {
        const { zone_id, ...query } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesV4PagePaginationArray, {
            query,
            ...options,
        });
    }
    /**
     * Deletes an existing firewall rule.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    delete(ruleId, params, options) {
        const { zone_id } = params;
        return this._client.delete(`/zones/${zone_id}/firewall/rules/${ruleId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Deletes existing firewall rules.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    bulkDelete(params, options) {
        const { zone_id } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesSinglePage, {
            method: 'delete',
            ...options,
        });
    }
    /**
     * Updates the priority of existing firewall rules.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    bulkEdit(params, options) {
        const { zone_id, body } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesSinglePage, {
            body: body,
            method: 'patch',
            ...options,
        });
    }
    /**
     * Updates one or more existing firewall rules.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    bulkUpdate(params, options) {
        const { zone_id, body } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesSinglePage, {
            body: body,
            method: 'put',
            ...options,
        });
    }
    /**
     * Updates the priority of an existing firewall rule.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    edit(ruleId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.getAPIList(`/zones/${zone_id}/firewall/rules/${ruleId}`, FirewallRulesSinglePage, {
            body,
            method: 'patch',
            ...options,
        });
    }
    /**
     * Fetches the details of a firewall rule.
     *
     * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details.
     */
    get(ruleId, params, options) {
        const { zone_id } = params;
        return this._client.get(`/zones/${zone_id}/firewall/rules/${ruleId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
exports.Rules = Rules;
class FirewallRulesSinglePage extends pagination_1.SinglePage {
}
exports.FirewallRulesSinglePage = FirewallRulesSinglePage;
class FirewallRulesV4PagePaginationArray extends pagination_1.V4PagePaginationArray {
}
exports.FirewallRulesV4PagePaginationArray = FirewallRulesV4PagePaginationArray;
Rules.FirewallRulesSinglePage = FirewallRulesSinglePage;
Rules.FirewallRulesV4PagePaginationArray = FirewallRulesV4PagePaginationArray;
//# sourceMappingURL=rules.js.map