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

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

export type FieldOptionCountItem = {
  value: string;
  count: number;
};

/** @internal */
export const FieldOptionCountItem$inboundSchema: z.ZodType<
  FieldOptionCountItem,
  unknown
> = z.object({
  value: z.string(),
  count: z.int(),
});

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