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

import * as z from "zod/v4-mini";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type EventsIngestResponse = {
  /**
   * Number of events inserted.
   */
  inserted: number;
  /**
   * Number of duplicate events skipped.
   */
  duplicates: number;
};

/** @internal */
export const EventsIngestResponse$inboundSchema: z.ZodMiniType<
  EventsIngestResponse,
  unknown
> = z.object({
  inserted: z.int(),
  duplicates: z._default(z.int(), 0),
});

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