/* * 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 { IssuingVelocityLimit, IssuingVelocityLimit$inboundSchema, IssuingVelocityLimit$Outbound, IssuingVelocityLimit$outboundSchema, } from "./issuingvelocitylimit.js"; export type IssuingControls = { /** * Indicates if the card is single-use. If true, the card closes after the first authorization. */ singleUse?: boolean | undefined; /** * Sets the spending limit per time interval. Only one limit per interval is supported. */ velocityLimits?: Array | undefined; }; /** @internal */ export const IssuingControls$inboundSchema: z.ZodType< IssuingControls, z.ZodTypeDef, unknown > = z.object({ singleUse: z.boolean().optional(), velocityLimits: z.array(IssuingVelocityLimit$inboundSchema).optional(), }); /** @internal */ export type IssuingControls$Outbound = { singleUse?: boolean | undefined; velocityLimits?: Array | undefined; }; /** @internal */ export const IssuingControls$outboundSchema: z.ZodType< IssuingControls$Outbound, z.ZodTypeDef, IssuingControls > = z.object({ singleUse: z.boolean().optional(), velocityLimits: z.array(IssuingVelocityLimit$outboundSchema).optional(), }); export function issuingControlsToJSON( issuingControls: IssuingControls, ): string { return JSON.stringify(IssuingControls$outboundSchema.parse(issuingControls)); } export function issuingControlsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IssuingControls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IssuingControls' from JSON`, ); }