/* * 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"; export const TaxPayerType = { 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 TaxPayerType = ClosedEnum; /** * The form used by the company for federal tax filing. One of: * * @remarks * - 941 (Quarterly federal tax return form) * - 944 (Annual federal tax return form) */ export const FilingForm = { NineHundredAndFortyOne: "941", NineHundredAndFortyFour: "944", } as const; /** * The form used by the company for federal tax filing. One of: * * @remarks * - 941 (Quarterly federal tax return form) * - 944 (Annual federal tax return form) */ export type FilingForm = ClosedEnum; /** * The status of EIN verification: * * @remarks * - `pending`: The EIN verification process has not completed (or the company does not yet have an EIN). * - `verified`: The EIN has been successfully verified as a valid EIN with the IRS. * - `failed`: The company's EIN did not pass verification. Common issues are being entered incorrectly or not matching the company's legal name. */ export const FederalTaxDetailsStatus = { Pending: "pending", Verified: "verified", Failed: "failed", } as const; /** * The status of EIN verification: * * @remarks * - `pending`: The EIN verification process has not completed (or the company does not yet have an EIN). * - `verified`: The EIN has been successfully verified as a valid EIN with the IRS. * - `failed`: The company's EIN did not pass verification. Common issues are being entered incorrectly or not matching the company's legal name. */ export type FederalTaxDetailsStatus = ClosedEnum< typeof FederalTaxDetailsStatus >; /** * Information about the status of verifying the company's Employer Identification Number (EIN) */ export type EinVerification = { /** * The status of EIN verification: * * @remarks * - `pending`: The EIN verification process has not completed (or the company does not yet have an EIN). * - `verified`: The EIN has been successfully verified as a valid EIN with the IRS. * - `failed`: The company's EIN did not pass verification. Common issues are being entered incorrectly or not matching the company's legal name. */ status?: FederalTaxDetailsStatus | undefined; }; export type FederalTaxDetails = { /** * 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; /** * What type of tax entity the company is. One of: * * @remarks * - C-Corporation * - S-Corporation * - Sole proprietor * - LLC * - LLP * - Limited partnership * - Co-ownership * - Association * - Trusteeship * - General partnership * - Joint venture * - Non-Profit */ taxPayerType?: TaxPayerType | null | undefined; /** * Whether the company is taxed as an S-Corporation. Tax payer types that may be taxed as an S-Corporation include: * * @remarks * - S-Corporation * - C-Corporation * - LLC */ taxableAsScorp?: boolean | undefined; /** * The form used by the company for federal tax filing. One of: * * @remarks * - 941 (Quarterly federal tax return form) * - 944 (Annual federal tax return form) */ filingForm?: FilingForm | undefined; /** * Whether company's Employer Identification Number (EIN) is present */ hasEin?: boolean | undefined; /** * Whether the EIN has been successfully verified as a valid EIN with the IRS. */ einVerified?: boolean | undefined; /** * Information about the status of verifying the company's Employer Identification Number (EIN) */ einVerification?: EinVerification | undefined; /** * The legal name of the company */ legalName?: string | undefined; /** * The date that these details took effect. */ effectiveDate?: string | undefined; /** * How often the company sends money to the IRS. One of: * * @remarks * - Semiweekly * - Monthly */ depositSchedule?: string | undefined; }; /** @internal */ export const TaxPayerType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(TaxPayerType); /** @internal */ export const FilingForm$inboundSchema: z.ZodNativeEnum = z .nativeEnum(FilingForm); /** @internal */ export const FederalTaxDetailsStatus$inboundSchema: z.ZodNativeEnum< typeof FederalTaxDetailsStatus > = z.nativeEnum(FederalTaxDetailsStatus); /** @internal */ export const EinVerification$inboundSchema: z.ZodType< EinVerification, z.ZodTypeDef, unknown > = z.object({ status: FederalTaxDetailsStatus$inboundSchema.optional(), }); export function einVerificationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EinVerification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EinVerification' from JSON`, ); } /** @internal */ export const FederalTaxDetails$inboundSchema: z.ZodType< FederalTaxDetails, z.ZodTypeDef, unknown > = z.object({ version: z.string().optional(), tax_payer_type: z.nullable(TaxPayerType$inboundSchema).optional(), taxable_as_scorp: z.boolean().optional(), filing_form: FilingForm$inboundSchema.optional(), has_ein: z.boolean().optional(), ein_verified: z.boolean().optional(), ein_verification: z.lazy(() => EinVerification$inboundSchema).optional(), legal_name: z.string().optional(), effective_date: z.string().optional(), deposit_schedule: z.string().optional(), }).transform((v) => { return remap$(v, { "tax_payer_type": "taxPayerType", "taxable_as_scorp": "taxableAsScorp", "filing_form": "filingForm", "has_ein": "hasEin", "ein_verified": "einVerified", "ein_verification": "einVerification", "legal_name": "legalName", "effective_date": "effectiveDate", "deposit_schedule": "depositSchedule", }); }); export function federalTaxDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FederalTaxDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FederalTaxDetails' from JSON`, ); }