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

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";

/**
 * Represents an error or exception that occurred during execution.
 */
export type Failure = {
  /**
   * A human-readable description of the failure.
   */
  message: string;
};

/** @internal */
export const Failure$inboundSchema: z.ZodType<Failure, unknown> = z.object({
  message: z.string(),
});

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