// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as RulesAPI from 'cloudflare/resources/firewall/rules';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class Rules extends APIResource {
    /**
     * Create one or more firewall rules.
     */
    create(zoneIdentifier, body, options) {
        return this._client.post(`/zones/${zoneIdentifier}/firewall/rules`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates an existing firewall rule.
     */
    update(zoneIdentifier, id, body, options) {
        return this._client.put(`/zones/${zoneIdentifier}/firewall/rules/${id}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    list(zoneIdentifier, query = {}, options) {
        if (isRequestOptions(query)) {
            return this.list(zoneIdentifier, {}, query);
        }
        return this._client.getAPIList(`/zones/${zoneIdentifier}/firewall/rules`, LegacyJhsFilterRulesV4PagePaginationArray, { query, ...options });
    }
    /**
     * Deletes an existing firewall rule.
     */
    delete(zoneIdentifier, id, body, options) {
        return this._client.delete(`/zones/${zoneIdentifier}/firewall/rules/${id}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates the priority of an existing firewall rule.
     */
    edit(zoneIdentifier, id, body, options) {
        return this._client.patch(`/zones/${zoneIdentifier}/firewall/rules/${id}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetches the details of a firewall rule.
     */
    get(zoneIdentifier, id, options) {
        return this._client.get(`/zones/${zoneIdentifier}/firewall/rules/${id}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class LegacyJhsFilterRulesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (Rules) {
    Rules.LegacyJhsFilterRulesV4PagePaginationArray = RulesAPI.LegacyJhsFilterRulesV4PagePaginationArray;
})(Rules || (Rules = {}));
//# sourceMappingURL=rules.mjs.map