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

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

export type ClassificationResponse = {
  id: string;
  model: string;
  results: Array<{ [k: string]: ClassificationTargetResult }>;
};

/** @internal */
export const ClassificationResponse$inboundSchema: z.ZodType<
  ClassificationResponse,
  unknown
> = z.object({
  id: z.string(),
  model: z.string(),
  results: z.array(
    z.record(z.string(), ClassificationTargetResult$inboundSchema),
  ),
});

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