/* * 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 source of the company benefit. This can be "internal", "external", or "partnered". Company benefits created via the API default to "external". Certain partners can create company benefits with a source of "partnered". */ export const Source = { Internal: "internal", External: "external", Partnered: "partnered", } as const; /** * The source of the company benefit. This can be "internal", "external", or "partnered". Company benefits created via the API default to "external". Certain partners can create company benefits with a source of "partnered". */ export type Source = ClosedEnum; export const CatchUpType = { Elective: "elective", Deemed: "deemed", } as const; export type CatchUpType = ClosedEnum; /** * The representation of a company benefit. */ export type CompanyBenefit = { /** * 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 number of employees enrolled in the benefit, only returned when enrollment_count query param is set to true. */ enrollmentCount?: number | undefined; /** * The UUID of the company. */ companyUuid?: string | undefined; /** * The UUID of the company benefit. */ uuid: string; /** * The type of the benefit to which the company benefit belongs. */ benefitType?: number | undefined; /** * Whether this benefit is active for employee participation. Company benefits may only be deactivated if no employees are actively participating. */ active: boolean; /** * The description of the company benefit. For example, a company may offer multiple benefits with an ID of 1 (for Medical Insurance). The description would show something more specific like “Kaiser Permanente” or “Blue Cross/ Blue Shield”. */ description?: string | undefined; /** * The source of the company benefit. This can be "internal", "external", or "partnered". Company benefits created via the API default to "external". Certain partners can create company benefits with a source of "partnered". */ source?: Source | undefined; /** * The partner name of the partner that created the company benefit. For example, "XYZ Corp". */ partnerName?: string | null | undefined; /** * Whether this company benefit can be deleted. Deletable will be set to true if the benefit has not been used in payroll, has no employee benefits associated, and the benefit is not owned by Gusto or a Partner */ deletable?: boolean | undefined; /** * Whether employee deductions and company contributions can be set as percentages of payroll for an individual employee. This is determined by the type of benefit and is not configurable by the company. */ supportsPercentageAmounts?: boolean | undefined; /** * Whether the employer is subject to pay employer taxes when an employee is on leave. Only applicable to third party sick pay benefits. */ responsibleForEmployerTaxes?: boolean | undefined; /** * Whether the employer is subject to file W-2 forms for an employee on leave. Only applicable to third party sick pay benefits. */ responsibleForEmployeeW2?: boolean | undefined; /** * The type of catch-up contribution for this benefit, as required by Section 603 of the SECURE 2.0 Act. Only applicable to pre-tax 401(k) and 403(b) benefits. */ catchUpType?: CatchUpType | null | undefined; }; /** @internal */ export const Source$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Source); /** @internal */ export const CatchUpType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(CatchUpType); /** @internal */ export const CompanyBenefit$inboundSchema: z.ZodType< CompanyBenefit, z.ZodTypeDef, unknown > = z.object({ version: z.string().optional(), enrollment_count: z.number().int().optional(), company_uuid: z.string().optional(), uuid: z.string(), benefit_type: z.number().int().optional(), active: z.boolean().default(true), description: z.string().optional(), source: Source$inboundSchema.optional(), partner_name: z.nullable(z.string()).optional(), deletable: z.boolean().optional(), supports_percentage_amounts: z.boolean().optional(), responsible_for_employer_taxes: z.boolean().optional(), responsible_for_employee_w2: z.boolean().optional(), catch_up_type: z.nullable(CatchUpType$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "enrollment_count": "enrollmentCount", "company_uuid": "companyUuid", "benefit_type": "benefitType", "partner_name": "partnerName", "supports_percentage_amounts": "supportsPercentageAmounts", "responsible_for_employer_taxes": "responsibleForEmployerTaxes", "responsible_for_employee_w2": "responsibleForEmployeeW2", "catch_up_type": "catchUpType", }); }); export function companyBenefitFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyBenefit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyBenefit' from JSON`, ); }