/* * 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 { ClosedEnum } from "../../types/enums.js"; import { RFCDate } from "../../types/rfcdate.js"; /** * The frequency that employees on this pay schedule are paid with Gusto. Only weekly, bi-weekly, twice per month, and monthly are supported on create and update. * * @remarks * * - `Every week`: Weekly pay. * - `Every other week`: Biweekly pay. * - `Twice per month`: Two pay dates per month; require day_1 and day_2 (use 31 for last day of month). * - `Monthly`: One pay date per month; require day_1 (1-31). */ export const PayScheduleUpdateRequestFrequency = { EveryWeek: "Every week", EveryOtherWeek: "Every other week", TwicePerMonth: "Twice per month", Monthly: "Monthly", } as const; /** * The frequency that employees on this pay schedule are paid with Gusto. Only weekly, bi-weekly, twice per month, and monthly are supported on create and update. * * @remarks * * - `Every week`: Weekly pay. * - `Every other week`: Biweekly pay. * - `Twice per month`: Two pay dates per month; require day_1 and day_2 (use 31 for last day of month). * - `Monthly`: One pay date per month; require day_1 (1-31). */ export type PayScheduleUpdateRequestFrequency = ClosedEnum< typeof PayScheduleUpdateRequestFrequency >; /** * Request body for updating a pay schedule. Sent in the pay_schedule_update root key. Version is required for optimistic concurrency. Pay schedules may be automatically adjusted if an onboarded company misses their first pay date; see [Create a pay schedule](https://docs.gusto.com/embedded-payroll/docs/create-a-pay-schedule). */ export type PayScheduleUpdateRequest = { /** * Current version of the pay schedule from the GET response; required for optimistic concurrency. Mismatch returns 409 Conflict. */ version: string; /** * With automatic payroll enabled, payroll runs automatically one day before payroll deadlines. When false, payroll does not run automatically and must be run manually. * * @remarks * For API versions before 2025-11-15 the request field is auto_pilot. */ autoPayroll?: boolean | undefined; frequency?: PayScheduleUpdateRequestFrequency | undefined; anchorPayDate?: RFCDate | undefined; anchorEndOfPayPeriod?: RFCDate | undefined; /** * An integer between 1 and 31 indicating the first day of the month that employees are paid. This field is only relevant for pay schedules with the "Twice per month" and "Monthly" frequencies. It will be null for pay schedules with other frequencies. * * @remarks */ day1?: number | null | undefined; /** * An integer between 1 and 31 indicating the second day of the month that employees are paid. This field is the second pay date for pay schedules with the "Twice per month" frequency. For semi-monthly pay schedules, set this field to 31. For months shorter than 31 days, the second pay date is set to the last day of the month. It will be null for pay schedules with other frequencies. * * @remarks */ day2?: number | null | undefined; /** * A custom pay schedule name; null clears any custom name so the default frequency description applies. */ customName?: string | null | undefined; }; /** @internal */ export const PayScheduleUpdateRequestFrequency$outboundSchema: z.ZodNativeEnum< typeof PayScheduleUpdateRequestFrequency > = z.nativeEnum(PayScheduleUpdateRequestFrequency); /** @internal */ export type PayScheduleUpdateRequest$Outbound = { version: string; auto_payroll?: boolean | undefined; frequency?: string | undefined; anchor_pay_date?: string | undefined; anchor_end_of_pay_period?: string | undefined; day_1?: number | null | undefined; day_2?: number | null | undefined; custom_name?: string | null | undefined; }; /** @internal */ export const PayScheduleUpdateRequest$outboundSchema: z.ZodType< PayScheduleUpdateRequest$Outbound, z.ZodTypeDef, PayScheduleUpdateRequest > = z.object({ version: z.string(), autoPayroll: z.boolean().optional(), frequency: PayScheduleUpdateRequestFrequency$outboundSchema.optional(), anchorPayDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), anchorEndOfPayPeriod: z.instanceof(RFCDate).transform(v => v.toString()) .optional(), day1: z.nullable(z.number().int()).optional(), day2: z.nullable(z.number().int()).optional(), customName: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { autoPayroll: "auto_payroll", anchorPayDate: "anchor_pay_date", anchorEndOfPayPeriod: "anchor_end_of_pay_period", day1: "day_1", day2: "day_2", customName: "custom_name", }); }); export function payScheduleUpdateRequestToJSON( payScheduleUpdateRequest: PayScheduleUpdateRequest, ): string { return JSON.stringify( PayScheduleUpdateRequest$outboundSchema.parse(payScheduleUpdateRequest), ); }