"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoadBalancersSinglePage = exports.LoadBalancers = void 0;
const resource_1 = require("cloudflaredev/resource");
const PreviewsAPI = __importStar(require("cloudflaredev/resources/load-balancers/previews"));
const RegionsAPI = __importStar(require("cloudflaredev/resources/load-balancers/regions"));
const SearchesAPI = __importStar(require("cloudflaredev/resources/load-balancers/searches"));
const MonitorsAPI = __importStar(require("cloudflaredev/resources/load-balancers/monitors/monitors"));
const PoolsAPI = __importStar(require("cloudflaredev/resources/load-balancers/pools/pools"));
const pagination_1 = require("cloudflaredev/pagination");
class LoadBalancers extends resource_1.APIResource {
    constructor() {
        super(...arguments);
        this.monitors = new MonitorsAPI.Monitors(this._client);
        this.pools = new PoolsAPI.Pools(this._client);
        this.previews = new PreviewsAPI.Previews(this._client);
        this.regions = new RegionsAPI.Regions(this._client);
        this.searches = new SearchesAPI.Searches(this._client);
    }
    /**
     * Create a new load balancer.
     */
    create(params, options) {
        const { zone_id, ...body } = params;
        return this._client.post(`/zones/${zone_id}/load_balancers`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Update a configured load balancer.
     */
    update(loadBalancerId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.put(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * List configured load balancers.
     */
    list(params, options) {
        const { zone_id } = params;
        return this._client.getAPIList(`/zones/${zone_id}/load_balancers`, LoadBalancersSinglePage, options);
    }
    /**
     * Delete a configured load balancer.
     */
    delete(loadBalancerId, params, options) {
        const { zone_id } = params;
        return this._client.delete(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Apply changes to an existing load balancer, overwriting the supplied properties.
     */
    edit(loadBalancerId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.patch(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetch a single configured load balancer.
     */
    get(loadBalancerId, params, options) {
        const { zone_id } = params;
        return this._client.get(`/zones/${zone_id}/load_balancers/${loadBalancerId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
exports.LoadBalancers = LoadBalancers;
class LoadBalancersSinglePage extends pagination_1.SinglePage {
}
exports.LoadBalancersSinglePage = LoadBalancersSinglePage;
(function (LoadBalancers) {
    LoadBalancers.Monitors = MonitorsAPI.Monitors;
    LoadBalancers.MonitorsSinglePage = MonitorsAPI.MonitorsSinglePage;
    LoadBalancers.Pools = PoolsAPI.Pools;
    LoadBalancers.PoolsSinglePage = PoolsAPI.PoolsSinglePage;
    LoadBalancers.Previews = PreviewsAPI.Previews;
    LoadBalancers.Regions = RegionsAPI.Regions;
    LoadBalancers.Searches = SearchesAPI.Searches;
})(LoadBalancers = exports.LoadBalancers || (exports.LoadBalancers = {}));
//# sourceMappingURL=load-balancers.js.map