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

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 GetSpanFields = {
  fieldDefinitions: Array<OtelFieldDefinition>;
};

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

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