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

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";

/**
 * Sampling capability structure, allowing fine-grained capability advertisement.
 */
export type SamplingCapability = {
  context?: { [k: string]: any } | null | undefined;
  tools?: { [k: string]: any } | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const SamplingCapability$inboundSchema: z.ZodType<
  SamplingCapability,
  unknown
> = z.object({
  context: z.nullable(z.record(z.string(), z.any())).optional(),
  tools: z.nullable(z.record(z.string(), z.any())).optional(),
}).catchall(z.any());

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