/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Compensation, Compensation$inboundSchema, Compensation$Outbound, Compensation$outboundSchema, } from "./compensation.js"; import { PayrollTotals, PayrollTotals$inboundSchema, PayrollTotals$Outbound, PayrollTotals$outboundSchema, } from "./payrolltotals.js"; export type EmployeePayroll = { /** * A unique identifier for an object. */ id: string | null; /** * ID of the employee */ employeeId?: string | null | undefined; /** * The unique identifier of the company. */ companyId?: string | null | undefined; /** * Whether or not the payroll has been successfully processed. Note that processed payrolls cannot be updated. */ processed: boolean | null; /** * The date the payroll was processed. */ processedDate?: string | null | undefined; /** * The date on which employees will be paid for the payroll. */ checkDate: string | null; /** * The start date, inclusive, of the pay period. */ startDate: string | null; /** * The end date, inclusive, of the pay period. */ endDate: string | null; /** * The overview of the payroll totals. */ totals?: PayrollTotals | undefined; /** * An array of compensations for the payroll. */ compensations?: Array | undefined; }; /** @internal */ export const EmployeePayroll$inboundSchema: z.ZodType< EmployeePayroll, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()), employee_id: z.nullable(z.string()).optional(), company_id: z.nullable(z.string()).optional(), processed: z.nullable(z.boolean()), processed_date: z.nullable(z.string()).optional(), check_date: z.nullable(z.string()), start_date: z.nullable(z.string()), end_date: z.nullable(z.string()), totals: PayrollTotals$inboundSchema.optional(), compensations: z.array(Compensation$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "employee_id": "employeeId", "company_id": "companyId", "processed_date": "processedDate", "check_date": "checkDate", "start_date": "startDate", "end_date": "endDate", }); }); /** @internal */ export type EmployeePayroll$Outbound = { id: string | null; employee_id?: string | null | undefined; company_id?: string | null | undefined; processed: boolean | null; processed_date?: string | null | undefined; check_date: string | null; start_date: string | null; end_date: string | null; totals?: PayrollTotals$Outbound | undefined; compensations?: Array | undefined; }; /** @internal */ export const EmployeePayroll$outboundSchema: z.ZodType< EmployeePayroll$Outbound, z.ZodTypeDef, EmployeePayroll > = z.object({ id: z.nullable(z.string()), employeeId: z.nullable(z.string()).optional(), companyId: z.nullable(z.string()).optional(), processed: z.nullable(z.boolean()), processedDate: z.nullable(z.string()).optional(), checkDate: z.nullable(z.string()), startDate: z.nullable(z.string()), endDate: z.nullable(z.string()), totals: PayrollTotals$outboundSchema.optional(), compensations: z.array(Compensation$outboundSchema).optional(), }).transform((v) => { return remap$(v, { employeeId: "employee_id", companyId: "company_id", processedDate: "processed_date", checkDate: "check_date", startDate: "start_date", endDate: "end_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EmployeePayroll$ { /** @deprecated use `EmployeePayroll$inboundSchema` instead. */ export const inboundSchema = EmployeePayroll$inboundSchema; /** @deprecated use `EmployeePayroll$outboundSchema` instead. */ export const outboundSchema = EmployeePayroll$outboundSchema; /** @deprecated use `EmployeePayroll$Outbound` instead. */ export type Outbound = EmployeePayroll$Outbound; } export function employeePayrollToJSON( employeePayroll: EmployeePayroll, ): string { return JSON.stringify(EmployeePayroll$outboundSchema.parse(employeePayroll)); } export function employeePayrollFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeePayroll$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeePayroll' from JSON`, ); }