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

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 {
  TempoTraceResource,
  TempoTraceResource$inboundSchema,
} from "./tempotraceresource.js";
import {
  TempoTraceScopeSpan,
  TempoTraceScopeSpan$inboundSchema,
} from "./tempotracescopespan.js";

export type TempoTraceBatch = {
  resource: TempoTraceResource;
  /**
   * The spans of the scope
   */
  scopeSpans?: Array<TempoTraceScopeSpan> | undefined;
};

/** @internal */
export const TempoTraceBatch$inboundSchema: z.ZodType<
  TempoTraceBatch,
  unknown
> = z.object({
  resource: TempoTraceResource$inboundSchema,
  scopeSpans: z.array(TempoTraceScopeSpan$inboundSchema).optional(),
});

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