/* * 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"; /** * Type of the time off policy. Currently only "vacation" and "sick" are supported */ export const TimeOffPolicyRequestPolicyType = { Vacation: "vacation", Sick: "sick", } as const; /** * Type of the time off policy. Currently only "vacation" and "sick" are supported */ export type TimeOffPolicyRequestPolicyType = ClosedEnum< typeof TimeOffPolicyRequestPolicyType >; /** * Accrual method of the time off policy */ export const AccrualMethod = { Unlimited: "unlimited", PerPayPeriod: "per_pay_period", PerCalendarYear: "per_calendar_year", PerAnniversaryYear: "per_anniversary_year", PerHourWorked: "per_hour_worked", PerHourWorkedNoOvertime: "per_hour_worked_no_overtime", PerHourPaid: "per_hour_paid", PerHourPaidNoOvertime: "per_hour_paid_no_overtime", } as const; /** * Accrual method of the time off policy */ export type AccrualMethod = ClosedEnum; /** * Request body for creating a time off policy */ export type TimeOffPolicyRequest = { /** * Name of the time off policy */ name: string; /** * Type of the time off policy. Currently only "vacation" and "sick" are supported */ policyType: TimeOffPolicyRequestPolicyType; /** * Accrual method of the time off policy */ accrualMethod: AccrualMethod; /** * The rate at which the time off hours will accrue for an employee on the policy. Represented as a float, e.g. "40.0". */ accrualRate?: string | null | undefined; /** * The number of hours an employee has to work or be paid for to accrue the number of hours set in the accrual rate. Only used for hourly policies (per_hour_paid, per_hour_paid_no_overtime, per_hour_work, per_hour_worked_no_overtime). Represented as a float, e.g. "40.0". */ accrualRateUnit?: string | null | undefined; /** * Boolean representing if an employee's accrued time off hours will be paid out on termination. If accrual_method is unlimited, then paid_out_on_termination must be `false`. */ paidOutOnTermination?: boolean | undefined; /** * Number of days before an employee on the policy will begin accruing time off hours. If accrual_method is per_anniversary_year, per_calendar_year, or unlimited, then accrual_waiting_period_days should be 0. */ accrualWaitingPeriodDays?: number | null | undefined; /** * The max number of hours an employee can carryover from one year to the next. If accrual_method is unlimited, then carryover_limit_hours must be blank. */ carryoverLimitHours?: string | null | undefined; /** * The max number of hours an employee can accrue in a year. If accrual_method is yearly (per_anniversary_year, per_calendar_year) or unlimited, then max_accrual_hours_per_year must be blank. */ maxAccrualHoursPerYear?: string | null | undefined; /** * The max number of hours an employee can accrue. If accrual_method is unlimited, then max_hours must be blank. */ maxHours?: string | null | undefined; /** * The date the policy resets. Format MM-DD */ policyResetDate?: string | null | undefined; /** * boolean representing if a policy has completed configuration */ complete?: boolean | undefined; }; /** @internal */ export const TimeOffPolicyRequestPolicyType$outboundSchema: z.ZodNativeEnum< typeof TimeOffPolicyRequestPolicyType > = z.nativeEnum(TimeOffPolicyRequestPolicyType); /** @internal */ export const AccrualMethod$outboundSchema: z.ZodNativeEnum< typeof AccrualMethod > = z.nativeEnum(AccrualMethod); /** @internal */ export type TimeOffPolicyRequest$Outbound = { name: string; policy_type: string; accrual_method: string; accrual_rate?: string | null | undefined; accrual_rate_unit?: string | null | undefined; paid_out_on_termination?: boolean | undefined; accrual_waiting_period_days?: number | null | undefined; carryover_limit_hours?: string | null | undefined; max_accrual_hours_per_year?: string | null | undefined; max_hours?: string | null | undefined; policy_reset_date?: string | null | undefined; complete?: boolean | undefined; }; /** @internal */ export const TimeOffPolicyRequest$outboundSchema: z.ZodType< TimeOffPolicyRequest$Outbound, z.ZodTypeDef, TimeOffPolicyRequest > = z.object({ name: z.string(), policyType: TimeOffPolicyRequestPolicyType$outboundSchema, accrualMethod: AccrualMethod$outboundSchema, accrualRate: z.nullable(z.string()).optional(), accrualRateUnit: z.nullable(z.string()).optional(), paidOutOnTermination: z.boolean().optional(), accrualWaitingPeriodDays: z.nullable(z.number().int()).optional(), carryoverLimitHours: z.nullable(z.string()).optional(), maxAccrualHoursPerYear: z.nullable(z.string()).optional(), maxHours: z.nullable(z.string()).optional(), policyResetDate: z.nullable(z.string()).optional(), complete: z.boolean().optional(), }).transform((v) => { return remap$(v, { policyType: "policy_type", accrualMethod: "accrual_method", accrualRate: "accrual_rate", accrualRateUnit: "accrual_rate_unit", paidOutOnTermination: "paid_out_on_termination", accrualWaitingPeriodDays: "accrual_waiting_period_days", carryoverLimitHours: "carryover_limit_hours", maxAccrualHoursPerYear: "max_accrual_hours_per_year", maxHours: "max_hours", policyResetDate: "policy_reset_date", }); }); export function timeOffPolicyRequestToJSON( timeOffPolicyRequest: TimeOffPolicyRequest, ): string { return JSON.stringify( TimeOffPolicyRequest$outboundSchema.parse(timeOffPolicyRequest), ); }