/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PayScheduleAutoPayrollEnablementBlocker, PayScheduleAutoPayrollEnablementBlocker$inboundSchema, } from "./payscheduleautopayrollenablementblocker.js"; import { PayScheduleFrequency, PayScheduleFrequency$inboundSchema, } from "./payschedulefrequency.js"; /** * Pay schedule returned from pay schedule endpoints (GET by ID, POST create, PUT update). Same fields as Pay-Schedule with a required `version` for [optimistic concurrency](https://docs.gusto.com/embedded-payroll/docs/api-fundamentals#optimistic-version-control). * * @remarks * * For API version 2025-11-15 and later, responses use `auto_payroll`; earlier versions use `auto_pilot` for the same semantic. */ export type PayScheduleShow = { /** * The unique identifier of the pay schedule in Gusto. */ uuid: string; /** * The current version of the pay schedule. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/api-fundamentals#optimistic-version-control) for information on how to use this field for optimistic concurrency. */ version: string; /** * The frequency that employees on this pay schedule are paid with Gusto. * * @remarks * * READ-ONLY in responses. Possible values: * * - `Every week`: Employees are paid weekly. * - `Every other week`: Employees are paid bi-weekly (every two weeks). * - `Twice per month`: Employees are paid on two fixed days each month (e.g. 1st and 15th); use day_1 and day_2. * - `Monthly`: Employees are paid once per month; use day_1 for the pay day. * - `Quarterly`: Employees are paid every three months. * - `Annually`: Employees are paid once per year. */ frequency?: PayScheduleFrequency | undefined; /** * The first date that employees on this pay schedule are paid with Gusto (ISO 8601 YYYY-MM-DD). */ anchorPayDate?: RFCDate | undefined; /** * The last date of the first pay period. This can be the same date as the anchor pay date (ISO 8601 YYYY-MM-DD). */ 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, this field should be set 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; /** * This field will be hourly when the pay schedule is for hourly employees, salaried when the pay schedule is for salaried employees, the department name if pay schedule is by department, and null when the pay schedule is for all employees. */ name?: string | null | undefined; /** * A custom name for a pay schedule; defaults to the pay frequency description when none was set by the partner. * * @remarks * * When the partner never set a custom name (or cleared it), this field contains the auto-generated description derived from frequency and pay days (e.g. "every 1st and 15th of the month", "every Friday"). When the partner set a custom name on create or update, this field contains that value. */ customName?: string | undefined; /** * With automatic payroll enabled, payroll runs automatically one day before payroll deadlines. When false, payroll does not run automatically. * * @remarks * For API version 2025-11-15 and later the response uses auto_payroll (Autopayroll) instead. */ autoPilot?: boolean | undefined; /** * With automatic payroll enabled, payroll runs automatically one day before payroll deadlines. When false, payroll does not run automatically. * * @remarks * Returned for API version 2025-11-15 and later; for earlier versions the response uses auto_pilot instead. */ autoPayroll?: boolean | undefined; /** * Whether this pay schedule is associated with any employees. A pay schedule is inactive when it's unassigned. */ active?: boolean | undefined; /** * List of blockers preventing automatic payroll from being enabled. If automatic payroll is already enabled, this field is null. */ autoPayrollEnablementBlockers?: | Array | null | undefined; }; /** @internal */ export const PayScheduleShow$inboundSchema: z.ZodType< PayScheduleShow, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), version: z.string(), frequency: PayScheduleFrequency$inboundSchema.optional(), anchor_pay_date: z.string().transform(v => new RFCDate(v)).optional(), anchor_end_of_pay_period: z.string().transform(v => new RFCDate(v)) .optional(), day_1: z.nullable(z.number().int()).optional(), day_2: z.nullable(z.number().int()).optional(), name: z.nullable(z.string()).optional(), custom_name: z.string().optional(), auto_pilot: z.boolean().optional(), auto_payroll: z.boolean().optional(), active: z.boolean().optional(), auto_payroll_enablement_blockers: z.nullable( z.array(PayScheduleAutoPayrollEnablementBlocker$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "anchor_pay_date": "anchorPayDate", "anchor_end_of_pay_period": "anchorEndOfPayPeriod", "day_1": "day1", "day_2": "day2", "custom_name": "customName", "auto_pilot": "autoPilot", "auto_payroll": "autoPayroll", "auto_payroll_enablement_blockers": "autoPayrollEnablementBlockers", }); }); export function payScheduleShowFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayScheduleShow$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayScheduleShow' from JSON`, ); }