/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { PaymentFrequency, PaymentFrequency$inboundSchema, PaymentFrequency$outboundSchema, } from "./paymentfrequency.js"; import { PaymentUnit, PaymentUnit$inboundSchema, PaymentUnit$outboundSchema, } from "./paymentunit.js"; /** * The FLSA status for this compensation. */ export const FlsaStatus = { Exempt: "exempt", SalariedNonexempt: "salaried-nonexempt", Nonexempt: "nonexempt", Owner: "owner", Other: "other", } as const; /** * The FLSA status for this compensation. */ export type FlsaStatus = ClosedEnum; export type EmployeeCompensation = { /** * A unique identifier for an object. */ id?: string | null | undefined; /** * The ID of the job to which the compensation belongs. */ jobId?: string | null | undefined; /** * The amount paid per payment unit. */ rate?: number | null | undefined; /** * Unit of measurement for employee compensation. */ paymentUnit?: PaymentUnit | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * The FLSA status for this compensation. */ flsaStatus?: FlsaStatus | null | undefined; /** * The date on which a change to an employee's compensation takes effect. */ effectiveDate?: string | null | undefined; /** * Frequency of employee compensation. */ paymentFrequency?: PaymentFrequency | null | undefined; }; export type EmployeeCompensationInput = { /** * The amount paid per payment unit. */ rate?: number | null | undefined; /** * Unit of measurement for employee compensation. */ paymentUnit?: PaymentUnit | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * The FLSA status for this compensation. */ flsaStatus?: FlsaStatus | null | undefined; /** * The date on which a change to an employee's compensation takes effect. */ effectiveDate?: string | null | undefined; /** * Frequency of employee compensation. */ paymentFrequency?: PaymentFrequency | null | undefined; }; /** @internal */ export const FlsaStatus$inboundSchema: z.ZodNativeEnum = z .nativeEnum(FlsaStatus); /** @internal */ export const FlsaStatus$outboundSchema: z.ZodNativeEnum = FlsaStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FlsaStatus$ { /** @deprecated use `FlsaStatus$inboundSchema` instead. */ export const inboundSchema = FlsaStatus$inboundSchema; /** @deprecated use `FlsaStatus$outboundSchema` instead. */ export const outboundSchema = FlsaStatus$outboundSchema; } /** @internal */ export const EmployeeCompensation$inboundSchema: z.ZodType< EmployeeCompensation, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()).optional(), job_id: z.nullable(z.string()).optional(), rate: z.nullable(z.number()).optional(), payment_unit: z.nullable(PaymentUnit$inboundSchema).optional(), currency: z.nullable(Currency$inboundSchema).optional(), flsa_status: z.nullable(FlsaStatus$inboundSchema).optional(), effective_date: z.nullable(z.string()).optional(), payment_frequency: z.nullable(PaymentFrequency$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "job_id": "jobId", "payment_unit": "paymentUnit", "flsa_status": "flsaStatus", "effective_date": "effectiveDate", "payment_frequency": "paymentFrequency", }); }); /** @internal */ export type EmployeeCompensation$Outbound = { id?: string | null | undefined; job_id?: string | null | undefined; rate?: number | null | undefined; payment_unit?: string | null | undefined; currency?: string | null | undefined; flsa_status?: string | null | undefined; effective_date?: string | null | undefined; payment_frequency?: string | null | undefined; }; /** @internal */ export const EmployeeCompensation$outboundSchema: z.ZodType< EmployeeCompensation$Outbound, z.ZodTypeDef, EmployeeCompensation > = z.object({ id: z.nullable(z.string()).optional(), jobId: z.nullable(z.string()).optional(), rate: z.nullable(z.number()).optional(), paymentUnit: z.nullable(PaymentUnit$outboundSchema).optional(), currency: z.nullable(Currency$outboundSchema).optional(), flsaStatus: z.nullable(FlsaStatus$outboundSchema).optional(), effectiveDate: z.nullable(z.string()).optional(), paymentFrequency: z.nullable(PaymentFrequency$outboundSchema).optional(), }).transform((v) => { return remap$(v, { jobId: "job_id", paymentUnit: "payment_unit", flsaStatus: "flsa_status", effectiveDate: "effective_date", paymentFrequency: "payment_frequency", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeeCompensation$ { /** @deprecated use `EmployeeCompensation$inboundSchema` instead. */ export const inboundSchema = EmployeeCompensation$inboundSchema; /** @deprecated use `EmployeeCompensation$outboundSchema` instead. */ export const outboundSchema = EmployeeCompensation$outboundSchema; /** @deprecated use `EmployeeCompensation$Outbound` instead. */ export type Outbound = EmployeeCompensation$Outbound; } export function employeeCompensationToJSON( employeeCompensation: EmployeeCompensation, ): string { return JSON.stringify( EmployeeCompensation$outboundSchema.parse(employeeCompensation), ); } export function employeeCompensationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeCompensation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeCompensation' from JSON`, ); } /** @internal */ export const EmployeeCompensationInput$inboundSchema: z.ZodType< EmployeeCompensationInput, z.ZodTypeDef, unknown > = z.object({ rate: z.nullable(z.number()).optional(), payment_unit: z.nullable(PaymentUnit$inboundSchema).optional(), currency: z.nullable(Currency$inboundSchema).optional(), flsa_status: z.nullable(FlsaStatus$inboundSchema).optional(), effective_date: z.nullable(z.string()).optional(), payment_frequency: z.nullable(PaymentFrequency$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "payment_unit": "paymentUnit", "flsa_status": "flsaStatus", "effective_date": "effectiveDate", "payment_frequency": "paymentFrequency", }); }); /** @internal */ export type EmployeeCompensationInput$Outbound = { rate?: number | null | undefined; payment_unit?: string | null | undefined; currency?: string | null | undefined; flsa_status?: string | null | undefined; effective_date?: string | null | undefined; payment_frequency?: string | null | undefined; }; /** @internal */ export const EmployeeCompensationInput$outboundSchema: z.ZodType< EmployeeCompensationInput$Outbound, z.ZodTypeDef, EmployeeCompensationInput > = z.object({ rate: z.nullable(z.number()).optional(), paymentUnit: z.nullable(PaymentUnit$outboundSchema).optional(), currency: z.nullable(Currency$outboundSchema).optional(), flsaStatus: z.nullable(FlsaStatus$outboundSchema).optional(), effectiveDate: z.nullable(z.string()).optional(), paymentFrequency: z.nullable(PaymentFrequency$outboundSchema).optional(), }).transform((v) => { return remap$(v, { paymentUnit: "payment_unit", flsaStatus: "flsa_status", effectiveDate: "effective_date", paymentFrequency: "payment_frequency", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeeCompensationInput$ { /** @deprecated use `EmployeeCompensationInput$inboundSchema` instead. */ export const inboundSchema = EmployeeCompensationInput$inboundSchema; /** @deprecated use `EmployeeCompensationInput$outboundSchema` instead. */ export const outboundSchema = EmployeeCompensationInput$outboundSchema; /** @deprecated use `EmployeeCompensationInput$Outbound` instead. */ export type Outbound = EmployeeCompensationInput$Outbound; } export function employeeCompensationInputToJSON( employeeCompensationInput: EmployeeCompensationInput, ): string { return JSON.stringify( EmployeeCompensationInput$outboundSchema.parse(employeeCompensationInput), ); } export function employeeCompensationInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeCompensationInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeCompensationInput' from JSON`, ); }