"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.Webhook$inboundSchema = exports.DisabledReason$inboundSchema = exports.DisabledReason = void 0;
exports.webhookFromJSON = webhookFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const status_js_1 = require("./status.js");
const unifiedapiid_js_1 = require("./unifiedapiid.js");
const webhookeventtype_js_1 = require("./webhookeventtype.js");
/**
 * Indicates why the webhook has been disabled. `retry_limit`: webhook reached its retry limit. `usage_limit`: account is over its usage limit. `delivery_url_validation_failed`: delivery URL failed validation during webhook creation or update.
 */
exports.DisabledReason = {
    None: "none",
    RetryLimit: "retry_limit",
    UsageLimit: "usage_limit",
    DeliveryUrlValidationFailed: "delivery_url_validation_failed",
};
/** @internal */
exports.DisabledReason$inboundSchema = z.nativeEnum(exports.DisabledReason);
/** @internal */
exports.Webhook$inboundSchema = z.object({
    id: z.string().optional(),
    description: z.nullable(z.string()).optional(),
    unified_api: unifiedapiid_js_1.UnifiedApiId$inboundSchema,
    status: status_js_1.Status$inboundSchema,
    disabled_reason: exports.DisabledReason$inboundSchema.optional(),
    delivery_url: z.string(),
    execute_base_url: z.string(),
    events: z.array(webhookeventtype_js_1.WebhookEventType$inboundSchema),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "unified_api": "unifiedApi",
        "disabled_reason": "disabledReason",
        "delivery_url": "deliveryUrl",
        "execute_base_url": "executeBaseUrl",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
    });
});
function webhookFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Webhook$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Webhook' from JSON`);
}
//# sourceMappingURL=webhook.js.map