/*
 * 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 {
  WebhookEndpoint,
  WebhookEndpoint$inboundSchema,
} from "./webhookendpoint.js";

export type ListResourceWebhookEndpoint = {
  items: Array<WebhookEndpoint>;
  pagination: Pagination;
};

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

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