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

export type BatchJobsOut = {
  data?: Array<BatchJobOut> | undefined;
  object?: "list" | undefined;
  total: number;
};

/** @internal */
export const BatchJobsOut$inboundSchema: z.ZodType<
  BatchJobsOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  data: z.array(BatchJobOut$inboundSchema).optional(),
  object: z.literal("list").default("list"),
  total: z.number().int(),
});

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