/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * A legal Agreement for an Enrollment. */ export type LegalAgreement = { /** * The friendly name of the agreement; Typically mirrors the enrollment it is attached to (e.g., `LENDING_FULLY_PAID_STOCK_LOAN`) */ agreementName?: string | undefined; /** * A URI referencing a static PDF containing the legalese of a given agreement; All agreements of the same nature link to the same publicly-available PDF. */ agreementUri?: string | undefined; /** * An internal version number based on typographical revisions of the related agreement; Version numbers are automatically updated when new agreements are available and should be of no technical concern to the integrator */ agreementVersion?: string | undefined; }; /** @internal */ export const LegalAgreement$inboundSchema: z.ZodType< LegalAgreement, z.ZodTypeDef, unknown > = z.object({ agreement_name: z.string().optional(), agreement_uri: z.string().optional(), agreement_version: z.string().optional(), }).transform((v) => { return remap$(v, { "agreement_name": "agreementName", "agreement_uri": "agreementUri", "agreement_version": "agreementVersion", }); }); /** @internal */ export type LegalAgreement$Outbound = { agreement_name?: string | undefined; agreement_uri?: string | undefined; agreement_version?: string | undefined; }; /** @internal */ export const LegalAgreement$outboundSchema: z.ZodType< LegalAgreement$Outbound, z.ZodTypeDef, LegalAgreement > = z.object({ agreementName: z.string().optional(), agreementUri: z.string().optional(), agreementVersion: z.string().optional(), }).transform((v) => { return remap$(v, { agreementName: "agreement_name", agreementUri: "agreement_uri", agreementVersion: "agreement_version", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LegalAgreement$ { /** @deprecated use `LegalAgreement$inboundSchema` instead. */ export const inboundSchema = LegalAgreement$inboundSchema; /** @deprecated use `LegalAgreement$outboundSchema` instead. */ export const outboundSchema = LegalAgreement$outboundSchema; /** @deprecated use `LegalAgreement$Outbound` instead. */ export type Outbound = LegalAgreement$Outbound; } export function legalAgreementToJSON(legalAgreement: LegalAgreement): string { return JSON.stringify(LegalAgreement$outboundSchema.parse(legalAgreement)); } export function legalAgreementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LegalAgreement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LegalAgreement' from JSON`, ); }