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

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 { FileSchema, FileSchema$inboundSchema } from "./fileschema.js";

export type ListFilesResponse = {
  data: Array<FileSchema>;
  object: string;
  total?: number | null | undefined;
};

/** @internal */
export const ListFilesResponse$inboundSchema: z.ZodType<
  ListFilesResponse,
  unknown
> = z.object({
  data: z.array(FileSchema$inboundSchema),
  object: z.string(),
  total: z.nullable(z.int()).optional(),
});

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