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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { Library, Library$inboundSchema } from "./library.js";
import {
  PaginationInfo,
  PaginationInfo$inboundSchema,
} from "./paginationinfo.js";

export type ListLibrariesResponse = {
  pagination: PaginationInfo;
  data: Array<Library>;
};

/** @internal */
export const ListLibrariesResponse$inboundSchema: z.ZodType<
  ListLibrariesResponse,
  unknown
> = z.object({
  pagination: PaginationInfo$inboundSchema,
  data: z.array(Library$inboundSchema),
});

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