/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Mandatory for Fedex only. License type of the recipient of the Alcohol Package. */ export const RecipientType = { Licensee: "licensee", Consumer: "consumer", } as const; /** * Mandatory for Fedex only. License type of the recipient of the Alcohol Package. */ export type RecipientType = ClosedEnum; /** * Indicates that a shipment contains Alcohol (Fedex and UPS only). */ export type Alcohol = { /** * Mandatory for Fedex and UPS. Specifies that the package contains Alcohol. */ containsAlcohol?: boolean | undefined; /** * Mandatory for Fedex only. License type of the recipient of the Alcohol Package. */ recipientType?: RecipientType | undefined; }; /** @internal */ export const RecipientType$inboundSchema: z.ZodMiniEnum = z.enum(RecipientType); /** @internal */ export const RecipientType$outboundSchema: z.ZodMiniEnum = RecipientType$inboundSchema; /** @internal */ export const Alcohol$inboundSchema: z.ZodMiniType = z.pipe( z.object({ contains_alcohol: z.optional(z.boolean()), recipient_type: z.optional(RecipientType$inboundSchema), }), z.transform((v) => { return remap$(v, { "contains_alcohol": "containsAlcohol", "recipient_type": "recipientType", }); }), ); /** @internal */ export type Alcohol$Outbound = { contains_alcohol?: boolean | undefined; recipient_type?: string | undefined; }; /** @internal */ export const Alcohol$outboundSchema: z.ZodMiniType = z.pipe( z.object({ containsAlcohol: z.optional(z.boolean()), recipientType: z.optional(RecipientType$outboundSchema), }), z.transform((v) => { return remap$(v, { containsAlcohol: "contains_alcohol", recipientType: "recipient_type", }); }), ); export function alcoholToJSON(alcohol: Alcohol): string { return JSON.stringify(Alcohol$outboundSchema.parse(alcohol)); } export function alcoholFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Alcohol$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Alcohol' from JSON`, ); }