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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  ExecutionLogRecord,
  ExecutionLogRecord$inboundSchema,
} from "./executionlogrecord.js";

export type ExecutionLogSearchResponse = {
  results: Array<ExecutionLogRecord>;
  nextCursor?: string | null | undefined;
};

/** @internal */
export const ExecutionLogSearchResponse$inboundSchema: z.ZodType<
  ExecutionLogSearchResponse,
  unknown
> = z.object({
  results: z.array(ExecutionLogRecord$inboundSchema),
  next_cursor: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "next_cursor": "nextCursor",
  });
});

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