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

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

export type GetTraceFields = {
  fieldDefinitions: Array<OtelFieldDefinition>;
};

/** @internal */
export const GetTraceFields$inboundSchema: z.ZodType<GetTraceFields, unknown> =
  z.object({
    field_definitions: z.array(OtelFieldDefinition$inboundSchema),
  }).transform((v) => {
    return remap$(v, {
      "field_definitions": "fieldDefinitions",
    });
  });

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