/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The employee's authorization status */ export const AuthorizationStatus = { Citizen: "citizen", Noncitizen: "noncitizen", PermanentResident: "permanent_resident", Alien: "alien", } as const; /** * The employee's authorization status */ export type AuthorizationStatus = ClosedEnum; export const DocumentType = { UscisAlienRegistrationNumber: "uscis_alien_registration_number", FormI94: "form_i94", ForeignPassport: "foreign_passport", } as const; export type DocumentType = ClosedEnum; /** * An employee's I-9 authorization */ export type I9Authorization = { /** * The UUID of the I-9 authorization */ uuid: string; /** * The UUID of the Form associated with this I-9 authorization. Use this with "Employee Forms" API endpoints. */ formUuid?: string | null | undefined; /** * The current version of the object. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/idempotency) for information on how to use this field. */ version: string; /** * The employee's authorization status */ authorizationStatus: AuthorizationStatus; /** * The document's document type */ documentType?: DocumentType | null | undefined; /** * Whether or not a `document_number` exists for this document. */ hasDocumentNumber?: boolean | null | undefined; /** * The document's expiration date */ expirationDate?: string | null | undefined; /** * The document's country of issuance */ country?: string | null | undefined; /** * Whether the employer has signed the Form I-9 */ employerSigned: boolean; /** * Whether the employee has signed the Form I-9 */ employeeSigned: boolean; /** * Any additional notes */ additionalInfo?: string | null | undefined; /** * Whether an alternative procedure authorized by DHS to examine documents was used */ altProcedure?: boolean | null | undefined; }; /** @internal */ export const AuthorizationStatus$inboundSchema: z.ZodNativeEnum< typeof AuthorizationStatus > = z.nativeEnum(AuthorizationStatus); /** @internal */ export const DocumentType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(DocumentType); /** @internal */ export const I9Authorization$inboundSchema: z.ZodType< I9Authorization, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), form_uuid: z.nullable(z.string()).optional(), version: z.string(), authorization_status: AuthorizationStatus$inboundSchema, document_type: z.nullable(DocumentType$inboundSchema).optional(), has_document_number: z.nullable(z.boolean()).optional(), expiration_date: z.nullable(z.string()).optional(), country: z.nullable(z.string()).optional(), employer_signed: z.boolean(), employee_signed: z.boolean(), additional_info: z.nullable(z.string()).optional(), alt_procedure: z.nullable(z.boolean()).optional(), }).transform((v) => { return remap$(v, { "form_uuid": "formUuid", "authorization_status": "authorizationStatus", "document_type": "documentType", "has_document_number": "hasDocumentNumber", "expiration_date": "expirationDate", "employer_signed": "employerSigned", "employee_signed": "employeeSigned", "additional_info": "additionalInfo", "alt_procedure": "altProcedure", }); }); export function i9AuthorizationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => I9Authorization$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'I9Authorization' from JSON`, ); }