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

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

export type SearchChatCompletionEventsResponse = {
  completionEvents: FeedResultChatCompletionEventPreview;
};

/** @internal */
export const SearchChatCompletionEventsResponse$inboundSchema: z.ZodType<
  SearchChatCompletionEventsResponse,
  unknown
> = z.object({
  completion_events: FeedResultChatCompletionEventPreview$inboundSchema,
}).transform((v) => {
  return remap$(v, {
    "completion_events": "completionEvents",
  });
});

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