/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Compensation, Compensation$inboundSchema } from "./compensation.js"; import { Location, Location$inboundSchema } from "./location.js"; /** * The representation of a job in Gusto. */ export type Job = { /** * The UUID of the job. */ uuid: string; /** * 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 | undefined; /** * The UUID of the employee to which the job belongs. */ employeeUuid?: string | undefined; /** * The date when the employee was hired or rehired for the job. */ hireDate?: string | undefined; /** * The title for the job. */ title: string | null; /** * Whether this is the employee's primary job. The value will be set to true unless an existing job exists for the employee. */ primary?: boolean | undefined; /** * The current compensation rate of the job. */ rate?: string | undefined; /** * The payment unit of the current compensation for the job. */ paymentUnit?: string | null | undefined; /** * The UUID of the current compensation of the job. */ currentCompensationUuid?: string | undefined; /** * Whether the employee owns at least 2% of the company. */ twoPercentShareholder?: boolean | undefined; /** * Whether this job is eligible for workers' compensation coverage in the state of Washington (WA). */ stateWcCovered?: boolean | null | undefined; /** * The risk class code for workers' compensation in Washington state. Please visit [Washington state's Risk Class page](https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/) to learn more. */ stateWcClassCode?: string | null | undefined; compensations?: Array | undefined; /** * The uuid of the employee's work location. */ locationUuid?: string | undefined; /** * The representation of an address in Gusto. */ location?: Location | undefined; }; /** @internal */ export const Job$inboundSchema: z.ZodType = z .object({ uuid: z.string(), version: z.string().optional(), employee_uuid: z.string().optional(), hire_date: z.string().optional(), title: z.nullable(z.string()).default(null), primary: z.boolean().optional(), rate: z.string().optional(), payment_unit: z.nullable(z.string()).optional(), current_compensation_uuid: z.string().optional(), two_percent_shareholder: z.boolean().optional(), state_wc_covered: z.nullable(z.boolean()).optional(), state_wc_class_code: z.nullable(z.string()).optional(), compensations: z.array(Compensation$inboundSchema).optional(), location_uuid: z.string().optional(), location: Location$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", "hire_date": "hireDate", "payment_unit": "paymentUnit", "current_compensation_uuid": "currentCompensationUuid", "two_percent_shareholder": "twoPercentShareholder", "state_wc_covered": "stateWcCovered", "state_wc_class_code": "stateWcClassCode", "location_uuid": "locationUuid", }); }); export function jobFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Job$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Job' from JSON`, ); }