/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { smartUnion } from "../../types/smartUnion.js"; import { BenefitCustomProperties, BenefitCustomProperties$Outbound, BenefitCustomProperties$outboundSchema, } from "./benefitcustomproperties.js"; export type BenefitCustomUpdateMetadata = string | number | number | boolean; export type BenefitCustomUpdate = { /** * Key-value object allowing you to store additional information. * * @remarks * * The key must be a string with a maximum length of **40 characters**. * The value must be either: * * * A string with a maximum length of **500 characters** * * An integer * * A floating-point number * * A boolean * * You can store up to **50 key-value pairs**. */ metadata?: { [k: string]: string | number | number | boolean } | undefined; /** * The description of the benefit. Will be displayed on products having this benefit. */ description?: string | null | undefined; type: "custom"; properties?: BenefitCustomProperties | null | undefined; }; /** @internal */ export type BenefitCustomUpdateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const BenefitCustomUpdateMetadata$outboundSchema: z.ZodMiniType< BenefitCustomUpdateMetadata$Outbound, BenefitCustomUpdateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function benefitCustomUpdateMetadataToJSON( benefitCustomUpdateMetadata: BenefitCustomUpdateMetadata, ): string { return JSON.stringify( BenefitCustomUpdateMetadata$outboundSchema.parse( benefitCustomUpdateMetadata, ), ); } /** @internal */ export type BenefitCustomUpdate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; description?: string | null | undefined; type: "custom"; properties?: BenefitCustomProperties$Outbound | null | undefined; }; /** @internal */ export const BenefitCustomUpdate$outboundSchema: z.ZodMiniType< BenefitCustomUpdate$Outbound, BenefitCustomUpdate > = z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), description: z.optional(z.nullable(z.string())), type: z.literal("custom"), properties: z.optional(z.nullable(BenefitCustomProperties$outboundSchema)), }); export function benefitCustomUpdateToJSON( benefitCustomUpdate: BenefitCustomUpdate, ): string { return JSON.stringify( BenefitCustomUpdate$outboundSchema.parse(benefitCustomUpdate), ); }