/* * 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"; /** * Monetary amount associated with the commission */ export type CommissionAmount1 = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; export type Commission = { /** * Monetary amount associated with the commission */ amount?: CommissionAmount1 | null | undefined; }; /** @internal */ export const CommissionAmount1$inboundSchema: z.ZodType< CommissionAmount1, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type CommissionAmount1$Outbound = { value?: string | undefined; }; /** @internal */ export const CommissionAmount1$outboundSchema: z.ZodType< CommissionAmount1$Outbound, z.ZodTypeDef, CommissionAmount1 > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CommissionAmount1$ { /** @deprecated use `CommissionAmount1$inboundSchema` instead. */ export const inboundSchema = CommissionAmount1$inboundSchema; /** @deprecated use `CommissionAmount1$outboundSchema` instead. */ export const outboundSchema = CommissionAmount1$outboundSchema; /** @deprecated use `CommissionAmount1$Outbound` instead. */ export type Outbound = CommissionAmount1$Outbound; } export function commissionAmount1ToJSON( commissionAmount1: CommissionAmount1, ): string { return JSON.stringify( CommissionAmount1$outboundSchema.parse(commissionAmount1), ); } export function commissionAmount1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CommissionAmount1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CommissionAmount1' from JSON`, ); } /** @internal */ export const Commission$inboundSchema: z.ZodType< Commission, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable(z.lazy(() => CommissionAmount1$inboundSchema)).optional(), }); /** @internal */ export type Commission$Outbound = { amount?: CommissionAmount1$Outbound | null | undefined; }; /** @internal */ export const Commission$outboundSchema: z.ZodType< Commission$Outbound, z.ZodTypeDef, Commission > = z.object({ amount: z.nullable(z.lazy(() => CommissionAmount1$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Commission$ { /** @deprecated use `Commission$inboundSchema` instead. */ export const inboundSchema = Commission$inboundSchema; /** @deprecated use `Commission$outboundSchema` instead. */ export const outboundSchema = Commission$outboundSchema; /** @deprecated use `Commission$Outbound` instead. */ export type Outbound = Commission$Outbound; } export function commissionToJSON(commission: Commission): string { return JSON.stringify(Commission$outboundSchema.parse(commission)); } export function commissionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Commission$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Commission' from JSON`, ); }