/* * 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 { PayScheduleAssignmentDepartment, PayScheduleAssignmentDepartment$inboundSchema, } from "./payscheduleassignmentdepartment.js"; import { PayScheduleAssignmentEmployee, PayScheduleAssignmentEmployee$inboundSchema, } from "./payscheduleassignmentemployee.js"; export const Type = { Single: "single", HourlySalaried: "hourly_salaried", ByEmployee: "by_employee", ByDepartment: "by_department", } as const; export type Type = ClosedEnum; /** * The representation of a pay schedule assignment. */ export type PayScheduleAssignment = { /** * The pay schedule assignment type. */ type?: Type | null | undefined; /** * Pay schedule for hourly employees. */ hourlyPayScheduleUuid?: string | null | undefined; /** * Pay schedule for salaried employees. */ salariedPayScheduleUuid?: string | null | undefined; /** * Default pay schedule for employees. */ defaultPayScheduleUuid?: string | null | undefined; /** * List of employees and their pay schedules. */ employees?: Array | null | undefined; /** * List of departments and their pay schedules. */ departments?: Array | null | undefined; }; /** @internal */ export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Type, ); /** @internal */ export const PayScheduleAssignment$inboundSchema: z.ZodType< PayScheduleAssignment, z.ZodTypeDef, unknown > = z.object({ type: z.nullable(Type$inboundSchema).optional(), hourly_pay_schedule_uuid: z.nullable(z.string()).optional(), salaried_pay_schedule_uuid: z.nullable(z.string()).optional(), default_pay_schedule_uuid: z.nullable(z.string()).optional(), employees: z.nullable(z.array(PayScheduleAssignmentEmployee$inboundSchema)) .optional(), departments: z.nullable( z.array(PayScheduleAssignmentDepartment$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "hourly_pay_schedule_uuid": "hourlyPayScheduleUuid", "salaried_pay_schedule_uuid": "salariedPayScheduleUuid", "default_pay_schedule_uuid": "defaultPayScheduleUuid", }); }); export function payScheduleAssignmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayScheduleAssignment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayScheduleAssignment' from JSON`, ); }