/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PostalAddressCreate, PostalAddressCreate$inboundSchema, PostalAddressCreate$Outbound, PostalAddressCreate$outboundSchema, } from "./postaladdresscreate.js"; /** * Classifies in what capacity (or if) the underlying natural person holds a job */ export enum EmploymentStatus { StatusUnspecified = "STATUS_UNSPECIFIED", Employed = "EMPLOYED", SelfEmployed = "SELF_EMPLOYED", Unemployed = "UNEMPLOYED", Retired = "RETIRED", Student = "STUDENT", } /** * Classifies in what capacity (or if) the underlying natural person holds a job */ export type EmploymentStatusOpen = OpenEnum; /** * Object containing information pertaining to a investor's current employer including the name, address, and duration of employment. */ export type EmploymentCreate = { /** * The business name of an investor's employer. */ employer?: string | undefined; /** * Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains). * * @remarks * * In typical usage an address would be created via user input or from importing existing data, depending on the type of process. * * Advice on address input / editing: - Use an i18n-ready address widget such as https://github.com/google/libaddressinput) - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. * * For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478 */ employerAddress?: PostalAddressCreate | undefined; /** * Classifies in what capacity (or if) the underlying natural person holds a job */ employmentStatus: EmploymentStatusOpen; /** * **Field Dependencies:** * * @remarks * * Required if `employment_status` is one of: * - `EMPLOYED` * - `SELF_EMPLOYED` */ occupation?: string | undefined; /** * **Field Dependencies:** * * @remarks * * Must be empty if `employment_status` is ___not___ one of: * - `EMPLOYED` * - `SELF_EMPLOYED` */ startYear?: number | undefined; }; /** @internal */ export const EmploymentStatus$inboundSchema: z.ZodType< EmploymentStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(EmploymentStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const EmploymentStatus$outboundSchema: z.ZodType< EmploymentStatusOpen, z.ZodTypeDef, EmploymentStatusOpen > = z.union([ z.nativeEnum(EmploymentStatus), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmploymentStatus$ { /** @deprecated use `EmploymentStatus$inboundSchema` instead. */ export const inboundSchema = EmploymentStatus$inboundSchema; /** @deprecated use `EmploymentStatus$outboundSchema` instead. */ export const outboundSchema = EmploymentStatus$outboundSchema; } /** @internal */ export const EmploymentCreate$inboundSchema: z.ZodType< EmploymentCreate, z.ZodTypeDef, unknown > = z.object({ employer: z.string().optional(), employer_address: PostalAddressCreate$inboundSchema.optional(), employment_status: EmploymentStatus$inboundSchema, occupation: z.string().optional(), start_year: z.number().int().optional(), }).transform((v) => { return remap$(v, { "employer_address": "employerAddress", "employment_status": "employmentStatus", "start_year": "startYear", }); }); /** @internal */ export type EmploymentCreate$Outbound = { employer?: string | undefined; employer_address?: PostalAddressCreate$Outbound | undefined; employment_status: string; occupation?: string | undefined; start_year?: number | undefined; }; /** @internal */ export const EmploymentCreate$outboundSchema: z.ZodType< EmploymentCreate$Outbound, z.ZodTypeDef, EmploymentCreate > = z.object({ employer: z.string().optional(), employerAddress: PostalAddressCreate$outboundSchema.optional(), employmentStatus: EmploymentStatus$outboundSchema, occupation: z.string().optional(), startYear: z.number().int().optional(), }).transform((v) => { return remap$(v, { employerAddress: "employer_address", employmentStatus: "employment_status", startYear: "start_year", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmploymentCreate$ { /** @deprecated use `EmploymentCreate$inboundSchema` instead. */ export const inboundSchema = EmploymentCreate$inboundSchema; /** @deprecated use `EmploymentCreate$outboundSchema` instead. */ export const outboundSchema = EmploymentCreate$outboundSchema; /** @deprecated use `EmploymentCreate$Outbound` instead. */ export type Outbound = EmploymentCreate$Outbound; } export function employmentCreateToJSON( employmentCreate: EmploymentCreate, ): string { return JSON.stringify( EmploymentCreate$outboundSchema.parse(employmentCreate), ); } export function employmentCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmploymentCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmploymentCreate' from JSON`, ); }