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

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

/**
 * Trace response in OpenTelemetry format.
 *
 * @remarks
 *
 * This is the unified trace format used across all trace providers (Tempo, ClickHouse, etc.).
 * Regardless of the underlying backend, all trace data is normalized to this Tempo-compatible
 * OpenTelemetry format to ensure consistency in the API response structure.
 */
export type TempoGetTraceResponse = {
  /**
   * The batches of the trace
   */
  batches?: Array<TempoTraceBatch> | undefined;
};

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

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