/* * 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 { RFCDate } from "../../types/rfcdate.js"; import { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.js"; import { PaySchedulePreview, PaySchedulePreview$inboundSchema, } from "../components/payschedulepreview.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export const GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion = { TwoThousandAndTwentyFiveMinus06Minus15: "2025-06-15", } as const; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export type GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion = ClosedEnum< typeof GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion >; /** * The frequency that employees on this pay schedule are paid with Gusto. */ export const Frequency = { 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. */ export type Frequency = ClosedEnum; export type GetV1CompaniesCompanyIdPaySchedulesPreviewRequest = { /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyId: string; /** * The frequency that employees on this pay schedule are paid with Gusto. */ frequency: Frequency; /** * The first date that employees on this pay schedule are paid with Gusto. */ anchorPayDate: RFCDate; /** * The last date of the first pay period. This can be the same date as the anchor pay date. */ anchorEndOfPayPeriod: RFCDate; /** * 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. */ day1?: number | 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. */ day2?: number | undefined; /** * End date for the preview range. If given, this date must be in the future. When unspecified, defaults to 18 months from today. */ endDate?: RFCDate | undefined; }; export type GetV1CompaniesCompanyIdPaySchedulesPreviewResponse = { httpMeta: HTTPMetadata; /** * Successful */ paySchedulePreview?: PaySchedulePreview | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion > = z.nativeEnum( GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion, ); /** @internal */ export const Frequency$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Frequency); /** @internal */ export type GetV1CompaniesCompanyIdPaySchedulesPreviewRequest$Outbound = { "X-Gusto-API-Version": string; company_id: string; frequency: string; anchor_pay_date: string; anchor_end_of_pay_period: string; day_1?: number | undefined; day_2?: number | undefined; end_date?: string | undefined; }; /** @internal */ export const GetV1CompaniesCompanyIdPaySchedulesPreviewRequest$outboundSchema: z.ZodType< GetV1CompaniesCompanyIdPaySchedulesPreviewRequest$Outbound, z.ZodTypeDef, GetV1CompaniesCompanyIdPaySchedulesPreviewRequest > = z.object({ xGustoAPIVersion: GetV1CompaniesCompanyIdPaySchedulesPreviewHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyId: z.string(), frequency: Frequency$outboundSchema, anchorPayDate: z.instanceof(RFCDate).transform(v => v.toString()), anchorEndOfPayPeriod: z.instanceof(RFCDate).transform(v => v.toString()), day1: z.number().int().optional(), day2: z.number().int().optional(), endDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyId: "company_id", anchorPayDate: "anchor_pay_date", anchorEndOfPayPeriod: "anchor_end_of_pay_period", day1: "day_1", day2: "day_2", endDate: "end_date", }); }); export function getV1CompaniesCompanyIdPaySchedulesPreviewRequestToJSON( getV1CompaniesCompanyIdPaySchedulesPreviewRequest: GetV1CompaniesCompanyIdPaySchedulesPreviewRequest, ): string { return JSON.stringify( GetV1CompaniesCompanyIdPaySchedulesPreviewRequest$outboundSchema.parse( getV1CompaniesCompanyIdPaySchedulesPreviewRequest, ), ); } /** @internal */ export const GetV1CompaniesCompanyIdPaySchedulesPreviewResponse$inboundSchema: z.ZodType< GetV1CompaniesCompanyIdPaySchedulesPreviewResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Pay-Schedule-Preview": PaySchedulePreview$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Pay-Schedule-Preview": "paySchedulePreview", }); }); export function getV1CompaniesCompanyIdPaySchedulesPreviewResponseFromJSON( jsonString: string, ): SafeParseResult< GetV1CompaniesCompanyIdPaySchedulesPreviewResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetV1CompaniesCompanyIdPaySchedulesPreviewResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetV1CompaniesCompanyIdPaySchedulesPreviewResponse' from JSON`, ); }