/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v4-mini";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { Pagination, Pagination$inboundSchema } from "./pagination.js";
import {
  WebhookDelivery,
  WebhookDelivery$inboundSchema,
} from "./webhookdelivery.js";

export type ListResourceWebhookDelivery = {
  items: Array<WebhookDelivery>;
  pagination: Pagination;
};

/** @internal */
export const ListResourceWebhookDelivery$inboundSchema: z.ZodMiniType<
  ListResourceWebhookDelivery,
  unknown
> = z.object({
  items: z.array(WebhookDelivery$inboundSchema),
  pagination: Pagination$inboundSchema,
});

export function listResourceWebhookDeliveryFromJSON(
  jsonString: string,
): SafeParseResult<ListResourceWebhookDelivery, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ListResourceWebhookDelivery$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ListResourceWebhookDelivery' from JSON`,
  );
}
