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

/**
 * Properties for a benefit of type `custom`.
 */
export type BenefitCustomProperties = {
  note: string | null;
};

/** @internal */
export const BenefitCustomProperties$inboundSchema: z.ZodMiniType<
  BenefitCustomProperties,
  unknown
> = z.object({
  note: z.nullable(z.string()),
});
/** @internal */
export type BenefitCustomProperties$Outbound = {
  note: string | null;
};

/** @internal */
export const BenefitCustomProperties$outboundSchema: z.ZodMiniType<
  BenefitCustomProperties$Outbound,
  BenefitCustomProperties
> = z.object({
  note: z.nullable(z.string()),
});

export function benefitCustomPropertiesToJSON(
  benefitCustomProperties: BenefitCustomProperties,
): string {
  return JSON.stringify(
    BenefitCustomProperties$outboundSchema.parse(benefitCustomProperties),
  );
}
export function benefitCustomPropertiesFromJSON(
  jsonString: string,
): SafeParseResult<BenefitCustomProperties, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => BenefitCustomProperties$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'BenefitCustomProperties' from JSON`,
  );
}
