"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
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 () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebhookSupport$inboundSchema = exports.VirtualWebhooks$inboundSchema = exports.WebhookSupportResources$inboundSchema = exports.RequestRate$inboundSchema = exports.Unit$inboundSchema = exports.ManagedVia$inboundSchema = exports.SubscriptionLevel$inboundSchema = exports.Mode$inboundSchema = exports.Unit = exports.ManagedVia = exports.SubscriptionLevel = exports.Mode = void 0;
exports.requestRateFromJSON = requestRateFromJSON;
exports.webhookSupportResourcesFromJSON = webhookSupportResourcesFromJSON;
exports.virtualWebhooksFromJSON = virtualWebhooksFromJSON;
exports.webhookSupportFromJSON = webhookSupportFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/**
 * Mode of the webhook support.
 */
exports.Mode = {
    Native: "native",
    Virtual: "virtual",
    None: "none",
};
/**
 * Received events are scoped to connection or across integration.
 */
exports.SubscriptionLevel = {
    Connection: "connection",
    Integration: "integration",
};
/**
 * How the subscription is managed in the downstream.
 */
exports.ManagedVia = {
    Manual: "manual",
    Api: "api",
};
/**
 * The window unit for the rate.
 */
exports.Unit = {
    Second: "second",
    Minute: "minute",
    Hour: "hour",
    Day: "day",
};
/** @internal */
exports.Mode$inboundSchema = z.nativeEnum(exports.Mode);
/** @internal */
exports.SubscriptionLevel$inboundSchema = z.nativeEnum(exports.SubscriptionLevel);
/** @internal */
exports.ManagedVia$inboundSchema = z
    .nativeEnum(exports.ManagedVia);
/** @internal */
exports.Unit$inboundSchema = z.nativeEnum(exports.Unit);
/** @internal */
exports.RequestRate$inboundSchema = z.object({
    rate: z.number().int(),
    size: z.number().int(),
    unit: exports.Unit$inboundSchema,
});
function requestRateFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RequestRate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequestRate' from JSON`);
}
/** @internal */
exports.WebhookSupportResources$inboundSchema = z.object({
    events: z.array(z.string()).optional(),
});
function webhookSupportResourcesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.WebhookSupportResources$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookSupportResources' from JSON`);
}
/** @internal */
exports.VirtualWebhooks$inboundSchema = z.object({
    request_rate: z.lazy(() => exports.RequestRate$inboundSchema),
    resources: z.record(z.lazy(() => exports.WebhookSupportResources$inboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "request_rate": "requestRate",
    });
});
function virtualWebhooksFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.VirtualWebhooks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VirtualWebhooks' from JSON`);
}
/** @internal */
exports.WebhookSupport$inboundSchema = z.object({
    mode: exports.Mode$inboundSchema.optional(),
    subscription_level: exports.SubscriptionLevel$inboundSchema.optional(),
    managed_via: exports.ManagedVia$inboundSchema.optional(),
    virtual_webhooks: z.lazy(() => exports.VirtualWebhooks$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "subscription_level": "subscriptionLevel",
        "managed_via": "managedVia",
        "virtual_webhooks": "virtualWebhooks",
    });
});
function webhookSupportFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.WebhookSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookSupport' from JSON`);
}
//# sourceMappingURL=webhooksupport.js.map