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

import * as z from "zod/v3";
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,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  model: z.string(),
  results: z.array(z.record(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`,
  );
}
