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

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

export type BenefitGrantError = {
  message: string;
  type: string;
  timestamp: string;
};

/** @internal */
export const BenefitGrantError$inboundSchema: z.ZodMiniType<
  BenefitGrantError,
  unknown
> = z.object({
  message: z.string(),
  type: z.string(),
  timestamp: z.string(),
});
/** @internal */
export type BenefitGrantError$Outbound = {
  message: string;
  type: string;
  timestamp: string;
};

/** @internal */
export const BenefitGrantError$outboundSchema: z.ZodMiniType<
  BenefitGrantError$Outbound,
  BenefitGrantError
> = z.object({
  message: z.string(),
  type: z.string(),
  timestamp: z.string(),
});

export function benefitGrantErrorToJSON(
  benefitGrantError: BenefitGrantError,
): string {
  return JSON.stringify(
    BenefitGrantError$outboundSchema.parse(benefitGrantError),
  );
}
export function benefitGrantErrorFromJSON(
  jsonString: string,
): SafeParseResult<BenefitGrantError, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => BenefitGrantError$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'BenefitGrantError' from JSON`,
  );
}
