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

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

export type ModerationResponse = {
  id: string;
  model: string;
  results: Array<ModerationObject>;
};

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

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