/* * 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"; import { CompanyAddress, CompanyAddress$inboundSchema, } from "./companyaddress.js"; export const EntityType = { CCorporation: "C-Corporation", SCorporation: "S-Corporation", SoleProprietor: "Sole proprietor", Llc: "LLC", Llp: "LLP", LimitedPartnership: "Limited partnership", CoOwnership: "Co-ownership", Association: "Association", Trusteeship: "Trusteeship", GeneralPartnership: "General partnership", JointVenture: "Joint venture", NonProfit: "Non-Profit", } as const; export type EntityType = ClosedEnum; /** * The Gusto product tier of the company (not applicable to Embedded partner managed companies). */ export const Tier = { Simple: "simple", Plus: "plus", Premium: "premium", Core: "core", Complete: "complete", Concierge: "concierge", ContractorOnly: "contractor_only", Basic: "basic", } as const; /** * The Gusto product tier of the company (not applicable to Embedded partner managed companies). */ export type Tier = ClosedEnum; /** * The status of the company in Gusto. "Approved" companies are approved to run payroll from a risk and compliance perspective. However, an approved company may still need to resolve other [payroll blockers](https://docs.gusto.com/embedded-payroll/docs/payroll-blockers) to be able to run payroll. "Not Approved" companies may not yet run payroll with Gusto and may need to complete onboarding or contact support. "Suspended" companies may not run payroll with Gusto. In order to unsuspend their account, the company must contact support. */ export const CompanyStatus = { Approved: "Approved", NotApproved: "Not Approved", Suspended: "Suspended", } as const; /** * The status of the company in Gusto. "Approved" companies are approved to run payroll from a risk and compliance perspective. However, an approved company may still need to resolve other [payroll blockers](https://docs.gusto.com/embedded-payroll/docs/payroll-blockers) to be able to run payroll. "Not Approved" companies may not yet run payroll with Gusto and may need to complete onboarding or contact support. "Suspended" companies may not run payroll with Gusto. In order to unsuspend their account, the company must contact support. */ export type CompanyStatus = ClosedEnum; export const PayScheduleType = { Single: "single", HourlySalaried: "hourly_salaried", ByEmployee: "by_employee", ByDepartment: "by_department", } as const; export type PayScheduleType = ClosedEnum; export const FundingType = { Ach: "ach", ReverseWire: "reverse_wire", WireIn: "wire_in", PartnerDisbursement: "partner_disbursement", Rtp: "rtp", LineOfCredit: "line_of_credit", } as const; export type FundingType = ClosedEnum; export type Hourly = { /** * The UUID of the hourly compensation rate. */ uuid?: string | null | undefined; /** * The name of the hourly compensation rate. */ name?: string | undefined; /** * The amount multiplied by the base rate of a job to calculate compensation. */ multiple?: number | undefined; }; export type Fixed = { /** * The UUID of the fixed compensation. */ uuid?: string | null | undefined; /** * The name of the fixed compensation. */ name?: string | undefined; }; export type CompanyPaidTimeOff = { /** * The UUID of the paid time off type. */ uuid?: string | null | undefined; /** * The name of the paid time off type. */ name?: string | undefined; }; /** * The available company-wide compensation rates for the company. */ export type Compensations = { /** * The available hourly compensation rates for the company. */ hourly?: Array | undefined; /** * The available fixed compensation rates for the company. */ fixed?: Array | undefined; /** * The available types of paid time off for the company. */ paidTimeOff?: Array | undefined; }; /** * The company's primary signatory's home address. */ export type CompanyHomeAddress = { street1?: string | undefined; street2?: string | null | undefined; city?: string | undefined; state?: string | undefined; zip?: string | undefined; country?: string | undefined; }; /** * The primary signatory of the company. */ export type PrimarySignatory = { /** * The UUID of the company's primary signatory. */ uuid?: string | undefined; /** * The company's primary signatory's first name. */ firstName?: string | undefined; /** * The company's primary signatory's middle initial. */ middleInitial?: string | null | undefined; /** * The company's primary signatory's last name. */ lastName?: string | undefined; /** * The company's primary signatory's phone number. */ phone?: string | undefined; /** * The company's primary signatory's email address. */ email?: string | undefined; /** * The company's primary signatory's home address. */ homeAddress?: CompanyHomeAddress | undefined; }; /** * The primary payroll admin of the company. */ export type PrimaryPayrollAdmin = { /** * The company's primary payroll admin's first name. */ firstName?: string | undefined; /** * The company's primary payroll admin's last name. */ lastName?: string | undefined; /** * The company's primary payroll admin's phone number. */ phone?: string | null | undefined; /** * The company's primary payroll admin's email address. */ email?: string | undefined; }; /** * The representation of a company in Gusto. */ export type Company = { /** * The Federal Employer Identification Number of the company. */ ein?: string | undefined; /** * The tax payer type of the company. */ entityType?: EntityType | null | undefined; /** * Whether the company only supports contractors. */ contractorOnly?: boolean | undefined; /** * The Gusto product tier of the company (not applicable to Embedded partner managed companies). */ tier?: Tier | null | undefined; /** * Whether or not the company is suspended in Gusto. Suspended companies may not run payroll. */ isSuspended?: boolean | undefined; /** * The status of the company in Gusto. "Approved" companies are approved to run payroll from a risk and compliance perspective. However, an approved company may still need to resolve other [payroll blockers](https://docs.gusto.com/embedded-payroll/docs/payroll-blockers) to be able to run payroll. "Not Approved" companies may not yet run payroll with Gusto and may need to complete onboarding or contact support. "Suspended" companies may not run payroll with Gusto. In order to unsuspend their account, the company must contact support. */ companyStatus?: CompanyStatus | undefined; /** * A unique identifier of the company in Gusto. */ uuid: string; /** * The name of the company. */ name?: string | undefined; /** * The slug of the name of the company. */ slug?: string | undefined; /** * The trade name of the company. */ tradeName?: string | null | undefined; /** * Whether the company is fully managed by a partner via the API */ isPartnerManaged?: boolean | undefined; /** * Whether or not Gusto has identified the company as representing a high fraud risk. */ isHighRiskBusiness?: boolean | undefined; /** * Whether or not the company is a marijuana-related business. */ isMarijuanaBusiness?: boolean | undefined; /** * The pay schedule assignment type. */ payScheduleType?: PayScheduleType | null | undefined; /** * Company's first invoiceable event date */ joinDate?: string | null | undefined; /** * Company's default funding type */ fundingType?: FundingType | null | undefined; /** * The locations of the company. */ locations?: Array | undefined; /** * The available company-wide compensation rates for the company. */ compensations?: Compensations | undefined; /** * The primary signatory of the company. */ primarySignatory?: PrimarySignatory | null | undefined; /** * The primary payroll admin of the company. */ primaryPayrollAdmin?: PrimaryPayrollAdmin | undefined; }; /** @internal */ export const EntityType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(EntityType); /** @internal */ export const Tier$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Tier, ); /** @internal */ export const CompanyStatus$inboundSchema: z.ZodNativeEnum< typeof CompanyStatus > = z.nativeEnum(CompanyStatus); /** @internal */ export const PayScheduleType$inboundSchema: z.ZodNativeEnum< typeof PayScheduleType > = z.nativeEnum(PayScheduleType); /** @internal */ export const FundingType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(FundingType); /** @internal */ export const Hourly$inboundSchema: z.ZodType = z .object({ uuid: z.nullable(z.string()).optional(), name: z.string().optional(), multiple: z.number().optional(), }); export function hourlyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Hourly$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Hourly' from JSON`, ); } /** @internal */ export const Fixed$inboundSchema: z.ZodType = z .object({ uuid: z.nullable(z.string()).optional(), name: z.string().optional(), }); export function fixedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Fixed$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Fixed' from JSON`, ); } /** @internal */ export const CompanyPaidTimeOff$inboundSchema: z.ZodType< CompanyPaidTimeOff, z.ZodTypeDef, unknown > = z.object({ uuid: z.nullable(z.string()).optional(), name: z.string().optional(), }); export function companyPaidTimeOffFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyPaidTimeOff$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyPaidTimeOff' from JSON`, ); } /** @internal */ export const Compensations$inboundSchema: z.ZodType< Compensations, z.ZodTypeDef, unknown > = z.object({ hourly: z.array(z.lazy(() => Hourly$inboundSchema)).optional(), fixed: z.array(z.lazy(() => Fixed$inboundSchema)).optional(), paid_time_off: z.array(z.lazy(() => CompanyPaidTimeOff$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "paid_time_off": "paidTimeOff", }); }); export function compensationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Compensations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Compensations' from JSON`, ); } /** @internal */ export const CompanyHomeAddress$inboundSchema: z.ZodType< CompanyHomeAddress, z.ZodTypeDef, unknown > = z.object({ street_1: z.string().optional(), street_2: z.nullable(z.string()).optional(), city: z.string().optional(), state: z.string().optional(), zip: z.string().optional(), country: z.string().optional(), }).transform((v) => { return remap$(v, { "street_1": "street1", "street_2": "street2", }); }); export function companyHomeAddressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyHomeAddress$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyHomeAddress' from JSON`, ); } /** @internal */ export const PrimarySignatory$inboundSchema: z.ZodType< PrimarySignatory, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), first_name: z.string().optional(), middle_initial: z.nullable(z.string()).optional(), last_name: z.string().optional(), phone: z.string().optional(), email: z.string().optional(), home_address: z.lazy(() => CompanyHomeAddress$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "middle_initial": "middleInitial", "last_name": "lastName", "home_address": "homeAddress", }); }); export function primarySignatoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PrimarySignatory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PrimarySignatory' from JSON`, ); } /** @internal */ export const PrimaryPayrollAdmin$inboundSchema: z.ZodType< PrimaryPayrollAdmin, z.ZodTypeDef, unknown > = z.object({ first_name: z.string().optional(), last_name: z.string().optional(), phone: z.nullable(z.string()).optional(), email: z.string().optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", }); }); export function primaryPayrollAdminFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PrimaryPayrollAdmin$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PrimaryPayrollAdmin' from JSON`, ); } /** @internal */ export const Company$inboundSchema: z.ZodType = z.object({ ein: z.string().optional(), entity_type: z.nullable(EntityType$inboundSchema).optional(), contractor_only: z.boolean().optional(), tier: z.nullable(Tier$inboundSchema).optional(), is_suspended: z.boolean().optional(), company_status: CompanyStatus$inboundSchema.optional(), uuid: z.string(), name: z.string().optional(), slug: z.string().optional(), trade_name: z.nullable(z.string()).optional(), is_partner_managed: z.boolean().optional(), is_high_risk_business: z.boolean().optional(), is_marijuana_business: z.boolean().optional(), pay_schedule_type: z.nullable(PayScheduleType$inboundSchema).optional(), join_date: z.nullable(z.string()).optional(), funding_type: z.nullable(FundingType$inboundSchema).optional(), locations: z.array(CompanyAddress$inboundSchema).optional(), compensations: z.lazy(() => Compensations$inboundSchema).optional(), primary_signatory: z.nullable(z.lazy(() => PrimarySignatory$inboundSchema)) .optional(), primary_payroll_admin: z.lazy(() => PrimaryPayrollAdmin$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "entity_type": "entityType", "contractor_only": "contractorOnly", "is_suspended": "isSuspended", "company_status": "companyStatus", "trade_name": "tradeName", "is_partner_managed": "isPartnerManaged", "is_high_risk_business": "isHighRiskBusiness", "is_marijuana_business": "isMarijuanaBusiness", "pay_schedule_type": "payScheduleType", "join_date": "joinDate", "funding_type": "fundingType", "primary_signatory": "primarySignatory", "primary_payroll_admin": "primaryPayrollAdmin", }); }); export function companyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Company$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Company' from JSON`, ); }