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

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { LibraryOut, LibraryOut$inboundSchema } from "./libraryout.js";

export type ListLibraryOut = {
  data: Array<LibraryOut>;
};

/** @internal */
export const ListLibraryOut$inboundSchema: z.ZodType<
  ListLibraryOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  data: z.array(LibraryOut$inboundSchema),
});

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