/* * 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 { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { EmployeeCustomField, EmployeeCustomField$inboundSchema, } from "./employeecustomfield.js"; import { EmployeeHomeAddress, EmployeeHomeAddress$inboundSchema, } from "./employeehomeaddress.js"; import { FlsaStatusType, FlsaStatusType$inboundSchema, } from "./flsastatustype.js"; import { Garnishment, Garnishment$inboundSchema } from "./garnishment.js"; import { Job, Job$inboundSchema } from "./job.js"; import { PaidTimeOff, PaidTimeOff$inboundSchema } from "./paidtimeoff.js"; import { Termination, Termination$inboundSchema } from "./termination.js"; export const OnboardingStatus = { OnboardingCompleted: "onboarding_completed", AdminOnboardingIncomplete: "admin_onboarding_incomplete", SelfOnboardingPendingInvite: "self_onboarding_pending_invite", SelfOnboardingInvited: "self_onboarding_invited", SelfOnboardingInvitedStarted: "self_onboarding_invited_started", SelfOnboardingInvitedOverdue: "self_onboarding_invited_overdue", SelfOnboardingCompletedByEmployee: "self_onboarding_completed_by_employee", SelfOnboardingAwaitingAdminReview: "self_onboarding_awaiting_admin_review", } as const; export type OnboardingStatus = ClosedEnum; /** * Configuration for an employee onboarding documents during onboarding */ export type OnboardingDocumentsConfig = { /** * The UUID of the onboarding documents config */ uuid?: string | null | undefined; /** * Whether to include Form I-9 for an employee during onboarding */ i9Document?: boolean | undefined; }; /** * The employee's payment method */ export const PaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", } as const; /** * The employee's payment method */ export type PaymentMethod = ClosedEnum; export const CurrentEmploymentStatus = { FullTime: "full_time", PartTimeUnderTwentyHours: "part_time_under_twenty_hours", PartTimeTwentyPlusHours: "part_time_twenty_plus_hours", Variable: "variable", Seasonal: "seasonal", } as const; export type CurrentEmploymentStatus = ClosedEnum< typeof CurrentEmploymentStatus >; /** * The current status of the member portal invitation. */ export const ShowEmployeesStatus = { Pending: "pending", Sent: "sent", Verified: "verified", Complete: "complete", Cancelled: "cancelled", } as const; /** * The current status of the member portal invitation. */ export type ShowEmployeesStatus = ClosedEnum; /** * Member portal invitation status information. Only included when the include param has the portal_invitations value set. */ export type MemberPortalInvitationStatus = { /** * The current status of the member portal invitation. */ status?: ShowEmployeesStatus | undefined; /** * Whether the invitation token has expired. */ tokenExpired?: boolean | null | undefined; /** * The date and time when the welcome email was sent. */ welcomeEmailSentAt?: Date | null | undefined; /** * The date and time when the password reset was last resent. */ lastPasswordResentAt?: Date | null | undefined; }; /** * The representation of an employee in Gusto. */ export type ShowEmployees = { /** * The UUID of the employee in Gusto. */ uuid: string; firstName: string; middleInitial?: string | null | undefined; lastName: string; /** * The personal email address of the employee. This is provided to support syncing users between our system and yours. You may not use this email address for any other purpose (e.g. marketing). */ email?: string | null | undefined; /** * The UUID of the company the employee is employed by. */ companyUuid?: string | undefined; /** * The UUID of the employee's manager. */ managerUuid?: string | null | undefined; /** * The current version of the employee. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/idempotency) for information on how to use this field. */ version?: string | undefined; /** * The employee's department in the company. */ department?: string | null | undefined; /** * Whether the employee is terminated. */ terminated?: boolean | undefined; /** * Whether the employee is a two percent shareholder of the company. This field only applies to companies with an S-Corp entity type. */ twoPercentShareholder?: boolean | null | undefined; /** * The work email address of the employee. This is provided to support syncing users between our system and yours. You may not use this email address for any other purpose (e.g. marketing). */ workEmail?: string | null | undefined; /** * Whether the employee has completed onboarding. */ onboarded?: boolean | undefined; /** * The current onboarding status of the employee */ onboardingStatus?: OnboardingStatus | null | undefined; /** * Configuration for an employee onboarding documents during onboarding */ onboardingDocumentsConfig?: OnboardingDocumentsConfig | undefined; jobs?: Array | undefined; eligiblePaidTimeOff?: Array | undefined; terminations?: Array | undefined; garnishments?: Array | undefined; /** * Custom fields are only included for the employee if the include param has the custom_fields value set */ customFields?: Array | undefined; dateOfBirth?: string | null | undefined; /** * Indicates whether the employee has an SSN in Gusto. */ hasSsn?: boolean | undefined; /** * Deprecated. This field always returns an empty string. */ ssn?: string | undefined; phone?: string | null | undefined; preferredFirstName?: string | null | undefined; /** * The employee's payment method */ paymentMethod: PaymentMethod; /** * The current employment status of the employee. Full-time employees work 30+ hours per week. Part-time employees are split into two groups: those that work 20-29 hours a week, and those that work under 20 hours a week. Variable employees have hours that vary each week. Seasonal employees are hired for 6 months of the year or less. */ currentEmploymentStatus?: CurrentEmploymentStatus | null | undefined; historical?: boolean | undefined; /** * The short format code of the employee */ employeeCode?: string | undefined; /** * The UUID of the department the employee is under */ departmentUuid?: string | null | undefined; title?: string | undefined; /** * The date when the employee was hired to the company */ hiredAt?: RFCDate | undefined; hiddenSsn?: string | undefined; /** * The FLSA status for this compensation. Salaried ('Exempt') employees are paid a fixed salary every pay period. Salaried with overtime ('Salaried Nonexempt') employees are paid a fixed salary every pay period, and receive overtime pay when applicable. Hourly ('Nonexempt') employees are paid for the hours they work, and receive overtime pay when applicable. Commissioned employees ('Commission Only Exempt') earn wages based only on commission. Commissioned with overtime ('Commission Only Nonexempt') earn wages based on commission, and receive overtime pay when applicable. Owners ('Owner') are employees that own at least twenty percent of the company. */ flsaStatus?: FlsaStatusType | undefined; applicableTaxIds?: Array | undefined; /** * Member portal invitation status information. Only included when the include param has the portal_invitations value set. */ memberPortalInvitationStatus?: | MemberPortalInvitationStatus | null | undefined; /** * Whether an external partner portal invitation webhook has been sent for this employee. Only included when the include param has the portal_invitations value set. */ partnerPortalInvitationSent?: boolean | null | undefined; currentHomeAddress?: EmployeeHomeAddress | undefined; allHomeAddresses?: Array | undefined; additionalProperties?: { [k: string]: any } | undefined; }; /** @internal */ export const OnboardingStatus$inboundSchema: z.ZodNativeEnum< typeof OnboardingStatus > = z.nativeEnum(OnboardingStatus); /** @internal */ export const OnboardingDocumentsConfig$inboundSchema: z.ZodType< OnboardingDocumentsConfig, z.ZodTypeDef, unknown > = z.object({ uuid: z.nullable(z.string()).optional(), i9_document: z.boolean().optional(), }).transform((v) => { return remap$(v, { "i9_document": "i9Document", }); }); export function onboardingDocumentsConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OnboardingDocumentsConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OnboardingDocumentsConfig' from JSON`, ); } /** @internal */ export const PaymentMethod$inboundSchema: z.ZodNativeEnum< typeof PaymentMethod > = z.nativeEnum(PaymentMethod); /** @internal */ export const CurrentEmploymentStatus$inboundSchema: z.ZodNativeEnum< typeof CurrentEmploymentStatus > = z.nativeEnum(CurrentEmploymentStatus); /** @internal */ export const ShowEmployeesStatus$inboundSchema: z.ZodNativeEnum< typeof ShowEmployeesStatus > = z.nativeEnum(ShowEmployeesStatus); /** @internal */ export const MemberPortalInvitationStatus$inboundSchema: z.ZodType< MemberPortalInvitationStatus, z.ZodTypeDef, unknown > = z.object({ status: ShowEmployeesStatus$inboundSchema.optional(), token_expired: z.nullable(z.boolean()).optional(), welcome_email_sent_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), last_password_resent_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "token_expired": "tokenExpired", "welcome_email_sent_at": "welcomeEmailSentAt", "last_password_resent_at": "lastPasswordResentAt", }); }); export function memberPortalInvitationStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MemberPortalInvitationStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MemberPortalInvitationStatus' from JSON`, ); } /** @internal */ export const ShowEmployees$inboundSchema: z.ZodType< ShowEmployees, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ uuid: z.string(), first_name: z.string(), middle_initial: z.nullable(z.string()).optional(), last_name: z.string(), email: z.nullable(z.string()).optional(), company_uuid: z.string().optional(), manager_uuid: z.nullable(z.string()).optional(), version: z.string().optional(), department: z.nullable(z.string()).optional(), terminated: z.boolean().optional(), two_percent_shareholder: z.nullable(z.boolean()).optional(), work_email: z.nullable(z.string()).optional(), onboarded: z.boolean().optional(), onboarding_status: z.nullable(OnboardingStatus$inboundSchema).optional(), onboarding_documents_config: z.lazy(() => OnboardingDocumentsConfig$inboundSchema ).optional(), jobs: z.array(Job$inboundSchema).optional(), eligible_paid_time_off: z.array(PaidTimeOff$inboundSchema).optional(), terminations: z.array(Termination$inboundSchema).optional(), garnishments: z.array(Garnishment$inboundSchema).optional(), custom_fields: z.array(EmployeeCustomField$inboundSchema).optional(), date_of_birth: z.nullable(z.string()).optional(), has_ssn: z.boolean().optional(), ssn: z.string().optional(), phone: z.nullable(z.string()).optional(), preferred_first_name: z.nullable(z.string()).optional(), payment_method: PaymentMethod$inboundSchema.default("Check"), current_employment_status: z.nullable(CurrentEmploymentStatus$inboundSchema) .optional(), historical: z.boolean().optional(), employee_code: z.string().optional(), department_uuid: z.nullable(z.string()).optional(), title: z.string().optional(), hired_at: z.string().transform(v => new RFCDate(v)).optional(), hidden_ssn: z.string().optional(), flsa_status: FlsaStatusType$inboundSchema.optional(), applicable_tax_ids: z.array(z.number()).optional(), member_portal_invitation_status: z.nullable( z.lazy(() => MemberPortalInvitationStatus$inboundSchema), ).optional(), partner_portal_invitation_sent: z.nullable(z.boolean()).optional(), current_home_address: EmployeeHomeAddress$inboundSchema.optional(), all_home_addresses: z.array(EmployeeHomeAddress$inboundSchema).optional(), }).catchall(z.any()), "additionalProperties", true, ).transform((v) => { return remap$(v, { "first_name": "firstName", "middle_initial": "middleInitial", "last_name": "lastName", "company_uuid": "companyUuid", "manager_uuid": "managerUuid", "two_percent_shareholder": "twoPercentShareholder", "work_email": "workEmail", "onboarding_status": "onboardingStatus", "onboarding_documents_config": "onboardingDocumentsConfig", "eligible_paid_time_off": "eligiblePaidTimeOff", "custom_fields": "customFields", "date_of_birth": "dateOfBirth", "has_ssn": "hasSsn", "preferred_first_name": "preferredFirstName", "payment_method": "paymentMethod", "current_employment_status": "currentEmploymentStatus", "employee_code": "employeeCode", "department_uuid": "departmentUuid", "hired_at": "hiredAt", "hidden_ssn": "hiddenSsn", "flsa_status": "flsaStatus", "applicable_tax_ids": "applicableTaxIds", "member_portal_invitation_status": "memberPortalInvitationStatus", "partner_portal_invitation_sent": "partnerPortalInvitationSent", "current_home_address": "currentHomeAddress", "all_home_addresses": "allHomeAddresses", }); }); export function showEmployeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShowEmployees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShowEmployees' from JSON`, ); }