// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as UARulesAPI from 'cloudflare/resources/firewall/ua-rules';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class UARules extends APIResource {
    /**
     * Creates a new User Agent Blocking rule in a zone.
     */
    create(zoneIdentifier, body, options) {
        return this._client.post(`/zones/${zoneIdentifier}/firewall/ua_rules`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates an existing User Agent Blocking rule.
     */
    update(zoneIdentifier, id, body, options) {
        return this._client.put(`/zones/${zoneIdentifier}/firewall/ua_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/ua_rules`, UARuleListResponsesV4PagePaginationArray, { query, ...options });
    }
    /**
     * Deletes an existing User Agent Blocking rule.
     */
    delete(zoneIdentifier, id, options) {
        return this._client.delete(`/zones/${zoneIdentifier}/firewall/ua_rules/${id}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetches the details of a User Agent Blocking rule.
     */
    get(zoneIdentifier, id, options) {
        return this._client.get(`/zones/${zoneIdentifier}/firewall/ua_rules/${id}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class UARuleListResponsesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (UARules) {
    UARules.UARuleListResponsesV4PagePaginationArray = UARulesAPI.UARuleListResponsesV4PagePaginationArray;
})(UARules || (UARules = {}));
//# sourceMappingURL=ua-rules.mjs.map