// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as RulesAPI from 'cloudflaredev/resources/waiting-rooms/rules';
import { SinglePage } from 'cloudflaredev/pagination';
export class Rules extends APIResource {
    /**
     * Only available for the Waiting Room Advanced subscription. Creates a rule for a
     * waiting room.
     */
    create(waitingRoomId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.post(`/zones/${zone_id}/waiting_rooms/${waitingRoomId}/rules`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Only available for the Waiting Room Advanced subscription. Replaces all rules
     * for a waiting room.
     */
    update(waitingRoomId, params, options) {
        const { zone_id, body } = params;
        return this._client.put(`/zones/${zone_id}/waiting_rooms/${waitingRoomId}/rules`, {
            body: body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Lists rules for a waiting room.
     */
    list(waitingRoomId, params, options) {
        const { zone_id } = params;
        return this._client.getAPIList(`/zones/${zone_id}/waiting_rooms/${waitingRoomId}/rules`, WaitingRoomRulesSinglePage, options);
    }
    /**
     * Deletes a rule for a waiting room.
     */
    delete(waitingRoomId, ruleId, params, options) {
        const { zone_id } = params;
        return this._client.delete(`/zones/${zone_id}/waiting_rooms/${waitingRoomId}/rules/${ruleId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Patches a rule for a waiting room.
     */
    edit(waitingRoomId, ruleId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.patch(`/zones/${zone_id}/waiting_rooms/${waitingRoomId}/rules/${ruleId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
}
export class WaitingRoomRulesSinglePage extends SinglePage {
}
(function (Rules) {
    Rules.WaitingRoomRulesSinglePage = RulesAPI.WaitingRoomRulesSinglePage;
})(Rules || (Rules = {}));
//# sourceMappingURL=rules.mjs.map