/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AmountDecimal, AmountDecimal$inboundSchema, AmountDecimal$Outbound, AmountDecimal$outboundSchema, } from "./amountdecimal.js"; /** * An adjustment to a wallet. */ export type Adjustment = { adjustmentID: string; walletID: string; amount: AmountDecimal; createdOn: Date; }; /** @internal */ export const Adjustment$inboundSchema: z.ZodType< Adjustment, z.ZodTypeDef, unknown > = z.object({ adjustmentID: z.string(), walletID: z.string(), amount: AmountDecimal$inboundSchema, createdOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), }); /** @internal */ export type Adjustment$Outbound = { adjustmentID: string; walletID: string; amount: AmountDecimal$Outbound; createdOn: string; }; /** @internal */ export const Adjustment$outboundSchema: z.ZodType< Adjustment$Outbound, z.ZodTypeDef, Adjustment > = z.object({ adjustmentID: z.string(), walletID: z.string(), amount: AmountDecimal$outboundSchema, createdOn: z.date().transform(v => v.toISOString()), }); export function adjustmentToJSON(adjustment: Adjustment): string { return JSON.stringify(Adjustment$outboundSchema.parse(adjustment)); } export function adjustmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Adjustment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Adjustment' from JSON`, ); }