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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export const Audience = {
  User: "user",
  Assistant: "assistant",
} as const;
export type Audience = OpenEnum<typeof Audience>;

export type Annotations = {
  audience?: Array<Audience> | null | undefined;
  priority?: number | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const Audience$inboundSchema: z.ZodType<Audience, unknown> = openEnums
  .inboundSchema(Audience);

/** @internal */
export const Annotations$inboundSchema: z.ZodType<Annotations, unknown> = z
  .object({
    audience: z.nullable(z.array(Audience$inboundSchema)).optional(),
    priority: z.nullable(z.number()).optional(),
  }).catchall(z.any());

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