/* * 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"; /** * Customer Referral Source */ export type CustomerReferralSourceUpdate = { /** * The name of the referrer */ name?: string | undefined; /** * The relationship of the referrer to the applicant */ relationshipToApplicant?: string | undefined; /** * The years the referrer has known the applicant If the referrer has known the applicant for less than a year, they must specify 1 */ relationshipYearsWithApplicant?: number | undefined; /** * The years the referrer has known the broker If the referrer has known the broker for less than a year, they must specify 1 */ relationshipYearsWithBroker?: number | undefined; }; /** @internal */ export const CustomerReferralSourceUpdate$inboundSchema: z.ZodType< CustomerReferralSourceUpdate, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), relationship_to_applicant: z.string().optional(), relationship_years_with_applicant: z.number().int().optional(), relationship_years_with_broker: z.number().int().optional(), }).transform((v) => { return remap$(v, { "relationship_to_applicant": "relationshipToApplicant", "relationship_years_with_applicant": "relationshipYearsWithApplicant", "relationship_years_with_broker": "relationshipYearsWithBroker", }); }); /** @internal */ export type CustomerReferralSourceUpdate$Outbound = { name?: string | undefined; relationship_to_applicant?: string | undefined; relationship_years_with_applicant?: number | undefined; relationship_years_with_broker?: number | undefined; }; /** @internal */ export const CustomerReferralSourceUpdate$outboundSchema: z.ZodType< CustomerReferralSourceUpdate$Outbound, z.ZodTypeDef, CustomerReferralSourceUpdate > = z.object({ name: z.string().optional(), relationshipToApplicant: z.string().optional(), relationshipYearsWithApplicant: z.number().int().optional(), relationshipYearsWithBroker: z.number().int().optional(), }).transform((v) => { return remap$(v, { relationshipToApplicant: "relationship_to_applicant", relationshipYearsWithApplicant: "relationship_years_with_applicant", relationshipYearsWithBroker: "relationship_years_with_broker", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CustomerReferralSourceUpdate$ { /** @deprecated use `CustomerReferralSourceUpdate$inboundSchema` instead. */ export const inboundSchema = CustomerReferralSourceUpdate$inboundSchema; /** @deprecated use `CustomerReferralSourceUpdate$outboundSchema` instead. */ export const outboundSchema = CustomerReferralSourceUpdate$outboundSchema; /** @deprecated use `CustomerReferralSourceUpdate$Outbound` instead. */ export type Outbound = CustomerReferralSourceUpdate$Outbound; } export function customerReferralSourceUpdateToJSON( customerReferralSourceUpdate: CustomerReferralSourceUpdate, ): string { return JSON.stringify( CustomerReferralSourceUpdate$outboundSchema.parse( customerReferralSourceUpdate, ), ); } export function customerReferralSourceUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerReferralSourceUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerReferralSourceUpdate' from JSON`, ); }