/* * 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"; export type DepartmentEmployees = { uuid?: string | undefined; }; export type Contractors = { uuid?: string | undefined; }; export type Department = { /** * 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 department */ uuid?: string | undefined; /** * The UUID of the company */ companyUuid?: string | undefined; /** * Name of the department */ title?: string | undefined; /** * Array of employees assigned to the department. */ employees?: Array | undefined; /** * Array of contractors assigned to the department. */ contractors?: Array | undefined; }; /** @internal */ export const DepartmentEmployees$inboundSchema: z.ZodType< DepartmentEmployees, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), }); export function departmentEmployeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DepartmentEmployees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DepartmentEmployees' from JSON`, ); } /** @internal */ export const Contractors$inboundSchema: z.ZodType< Contractors, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), }); export function contractorsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Contractors$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Contractors' from JSON`, ); } /** @internal */ export const Department$inboundSchema: z.ZodType< Department, z.ZodTypeDef, unknown > = z.object({ version: z.string().optional(), uuid: z.string().optional(), company_uuid: z.string().optional(), title: z.string().optional(), employees: z.array(z.lazy(() => DepartmentEmployees$inboundSchema)) .optional(), contractors: z.array(z.lazy(() => Contractors$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", }); }); export function departmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Department$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Department' from JSON`, ); }