/* * 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"; /** * Experience level for this occupation. */ export const ExperienceLevel = { Novice: "novice", Intermediate: "intermediate", Average: "average", Skilled: "skilled", Expert: "expert", } as const; /** * Experience level for this occupation. */ export type ExperienceLevel = ClosedEnum; export type Occupations = { /** * Bureau of Labor Statistics (BLS) occupation code. */ code: string; /** * Occupation name. */ name?: string | undefined; /** * Occupation description. */ description?: string | undefined; /** * Experience level for this occupation. */ experienceLevel: ExperienceLevel; /** * Percentage of time spent in this occupation (as decimal string, 0-1). */ timePercentage: string; /** * Whether this is the primary occupation. */ primary?: boolean | undefined; }; /** * A salary estimate calculation for an S-Corp owner based on occupation, experience level, location, and business revenue. */ export type SalaryEstimate = { /** * The UUID of the salary estimate. */ uuid: string; /** * The UUID of the employee this salary estimate is for. */ employeeUuid: string | null; /** * The UUID of the employee job this salary estimate is associated with (once accepted). */ employeeJobUuid?: string | null | undefined; /** * The annual net revenue of the business used for salary calculations. */ annualNetRevenue: string | null; /** * The ZIP code used for location-based salary calculations. */ zipCode: string | null; /** * The calculated reasonable salary estimate in cents. Null if not yet calculated. */ result?: number | null | undefined; /** * The timestamp when this salary estimate was accepted and finalized. */ acceptedAt?: Date | null | undefined; /** * The timestamp when this salary estimate was created. */ createdAt: Date; /** * The timestamp when this salary estimate was last updated. */ updatedAt: Date; /** * Array of occupations with their experience levels and time allocations. */ occupations: Array; }; /** @internal */ export const ExperienceLevel$inboundSchema: z.ZodNativeEnum< typeof ExperienceLevel > = z.nativeEnum(ExperienceLevel); /** @internal */ export const Occupations$inboundSchema: z.ZodType< Occupations, z.ZodTypeDef, unknown > = z.object({ code: z.string(), name: z.string().optional(), description: z.string().optional(), experience_level: ExperienceLevel$inboundSchema, time_percentage: z.string(), primary: z.boolean().optional(), }).transform((v) => { return remap$(v, { "experience_level": "experienceLevel", "time_percentage": "timePercentage", }); }); export function occupationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Occupations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Occupations' from JSON`, ); } /** @internal */ export const SalaryEstimate$inboundSchema: z.ZodType< SalaryEstimate, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), employee_uuid: z.nullable(z.string()), employee_job_uuid: z.nullable(z.string()).optional(), annual_net_revenue: z.nullable(z.string()), zip_code: z.nullable(z.string()), result: z.nullable(z.number().int()).optional(), accepted_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), occupations: z.array(z.lazy(() => Occupations$inboundSchema)), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", "employee_job_uuid": "employeeJobUuid", "annual_net_revenue": "annualNetRevenue", "zip_code": "zipCode", "accepted_at": "acceptedAt", "created_at": "createdAt", "updated_at": "updatedAt", }); }); export function salaryEstimateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SalaryEstimate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SalaryEstimate' from JSON`, ); }