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

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

export type PaginatedResultDatasetImportTask = {
  results?: Array<DatasetImportTask> | undefined;
  count: number;
  next?: string | null | undefined;
  previous?: string | null | undefined;
};

/** @internal */
export const PaginatedResultDatasetImportTask$inboundSchema: z.ZodType<
  PaginatedResultDatasetImportTask,
  unknown
> = z.object({
  results: z.array(DatasetImportTask$inboundSchema).optional(),
  count: z.int(),
  next: z.nullable(z.string()).optional(),
  previous: z.nullable(z.string()).optional(),
});

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