/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Tax = { /** * The name of the tax. */ name?: string | null | undefined; /** * Paid by employer. */ employer?: boolean | null | undefined; /** * The amount of the tax. */ amount?: number | null | undefined; }; /** @internal */ export const Tax$inboundSchema: z.ZodType = z .object({ name: z.nullable(z.string()).optional(), employer: z.nullable(z.boolean()).optional(), amount: z.nullable(z.number()).optional(), }); /** @internal */ export type Tax$Outbound = { name?: string | null | undefined; employer?: boolean | null | undefined; amount?: number | null | undefined; }; /** @internal */ export const Tax$outboundSchema: z.ZodType = z .object({ name: z.nullable(z.string()).optional(), employer: z.nullable(z.boolean()).optional(), amount: z.nullable(z.number()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Tax$ { /** @deprecated use `Tax$inboundSchema` instead. */ export const inboundSchema = Tax$inboundSchema; /** @deprecated use `Tax$outboundSchema` instead. */ export const outboundSchema = Tax$outboundSchema; /** @deprecated use `Tax$Outbound` instead. */ export type Outbound = Tax$Outbound; } export function taxToJSON(tax: Tax): string { return JSON.stringify(Tax$outboundSchema.parse(tax)); } export function taxFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Tax$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Tax' from JSON`, ); }