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

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

export type FetchFieldOptionCountsResponse = {
  counts: Array<FieldOptionCountItem>;
};

/** @internal */
export const FetchFieldOptionCountsResponse$inboundSchema: z.ZodType<
  FetchFieldOptionCountsResponse,
  unknown
> = z.object({
  counts: z.array(FieldOptionCountItem$inboundSchema),
});

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