/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * The status of the time off request. */ export const TimeOffRequestStatusStatus = { Requested: "requested", Approved: "approved", Declined: "declined", Cancelled: "cancelled", Deleted: "deleted", Other: "other", } as const; /** * The status of the time off request. */ export type TimeOffRequestStatusStatus = OpenEnum< typeof TimeOffRequestStatusStatus >; /** * The type of request */ export const RequestType = { Vacation: "vacation", Sick: "sick", Personal: "personal", JuryDuty: "jury_duty", Volunteer: "volunteer", Bereavement: "bereavement", Other: "other", } as const; /** * The type of request */ export type RequestType = OpenEnum; /** * The unit of time off requested. Possible values include: `hours`, `days`, or `other`. */ export const Units = { Days: "days", Hours: "hours", Other: "other", } as const; /** * The unit of time off requested. Possible values include: `hours`, `days`, or `other`. */ export type Units = OpenEnum; export type Notes = { employee?: string | null | undefined; manager?: string | null | undefined; }; export type TimeOffRequest = { /** * A unique identifier for an object. */ id?: string | undefined; /** * ID of the employee */ employeeId?: string | null | undefined; /** * ID of the policy */ policyId?: string | null | undefined; /** * The status of the time off request. */ status?: TimeOffRequestStatusStatus | null | undefined; /** * Description of the time off request. */ description?: string | null | undefined; /** * The start date of the time off request. */ startDate?: string | null | undefined; /** * The end date of the time off request. */ endDate?: string | null | undefined; /** * The date the request was made. */ requestDate?: string | null | undefined; /** * The type of request */ requestType?: RequestType | null | undefined; /** * The date the request was approved */ approvalDate?: string | null | undefined; /** * The unit of time off requested. Possible values include: `hours`, `days`, or `other`. */ units?: Units | null | undefined; /** * The amount of time off requested. */ amount?: number | null | undefined; /** * The day part of the time off request. */ dayPart?: string | null | undefined; notes?: Notes | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; /** * The policy type of the time off request */ policyType?: string | undefined; }; export type TimeOffRequestInput = { /** * ID of the employee */ employeeId?: string | null | undefined; /** * ID of the policy */ policyId?: string | null | undefined; /** * The status of the time off request. */ status?: TimeOffRequestStatusStatus | null | undefined; /** * Description of the time off request. */ description?: string | null | undefined; /** * The start date of the time off request. */ startDate?: string | null | undefined; /** * The end date of the time off request. */ endDate?: string | null | undefined; /** * The date the request was made. */ requestDate?: string | null | undefined; /** * The type of request */ requestType?: RequestType | null | undefined; /** * The date the request was approved */ approvalDate?: string | null | undefined; /** * The unit of time off requested. Possible values include: `hours`, `days`, or `other`. */ units?: Units | null | undefined; /** * The amount of time off requested. */ amount?: number | null | undefined; /** * The day part of the time off request. */ dayPart?: string | null | undefined; notes?: Notes | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; /** * The policy type of the time off request */ policyType?: string | undefined; }; /** @internal */ export const TimeOffRequestStatusStatus$inboundSchema: z.ZodType< TimeOffRequestStatusStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(TimeOffRequestStatusStatus) ); /** @internal */ export const TimeOffRequestStatusStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, TimeOffRequestStatusStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(TimeOffRequestStatusStatus) ); /** @internal */ export const RequestType$inboundSchema: z.ZodType< RequestType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(RequestType)); /** @internal */ export const RequestType$outboundSchema: z.ZodType< string, z.ZodTypeDef, RequestType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(RequestType)); /** @internal */ export const Units$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(Units)); /** @internal */ export const Units$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(Units)); /** @internal */ export const Notes$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ employee: z.nullable(types.string()).optional(), manager: z.nullable(types.string()).optional(), }) ); /** @internal */ export type Notes$Outbound = { employee?: string | null | undefined; manager?: string | null | undefined; }; /** @internal */ export const Notes$outboundSchema: z.ZodType< Notes$Outbound, z.ZodTypeDef, Notes > = /* @__PURE__ */ lazySchema$(() => z.object({ employee: z.nullable(z.string()).optional(), manager: z.nullable(z.string()).optional(), }) ); export function notesToJSON(notes: Notes): string { return JSON.stringify(Notes$outboundSchema.parse(notes)); } export function notesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Notes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Notes' from JSON`, ); } /** @internal */ export const TimeOffRequest$inboundSchema: z.ZodType< TimeOffRequest, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), employee_id: z.nullable(types.string()).optional(), policy_id: z.nullable(types.string()).optional(), status: z.nullable(TimeOffRequestStatusStatus$inboundSchema).optional(), description: z.nullable(types.string()).optional(), start_date: z.nullable(types.string()).optional(), end_date: z.nullable(types.string()).optional(), request_date: z.nullable(types.string()).optional(), request_type: z.nullable(RequestType$inboundSchema).optional(), approval_date: z.nullable(types.string()).optional(), units: z.nullable(Units$inboundSchema).optional(), amount: z.nullable(types.number()).optional(), day_part: z.nullable(types.string()).optional(), notes: types.optional(z.lazy(() => Notes$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), policy_type: types.optional(types.string()), }).transform((v) => { return remap$(v, { "employee_id": "employeeId", "policy_id": "policyId", "start_date": "startDate", "end_date": "endDate", "request_date": "requestDate", "request_type": "requestType", "approval_date": "approvalDate", "day_part": "dayPart", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", "policy_type": "policyType", }); }) ); export function timeOffRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TimeOffRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TimeOffRequest' from JSON`, ); } /** @internal */ export type TimeOffRequestInput$Outbound = { employee_id?: string | null | undefined; policy_id?: string | null | undefined; status?: string | null | undefined; description?: string | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; request_date?: string | null | undefined; request_type?: string | null | undefined; approval_date?: string | null | undefined; units?: string | null | undefined; amount?: number | null | undefined; day_part?: string | null | undefined; notes?: Notes$Outbound | undefined; pass_through?: Array | undefined; policy_type?: string | undefined; }; /** @internal */ export const TimeOffRequestInput$outboundSchema: z.ZodType< TimeOffRequestInput$Outbound, z.ZodTypeDef, TimeOffRequestInput > = /* @__PURE__ */ lazySchema$(() => z.object({ employeeId: z.nullable(z.string()).optional(), policyId: z.nullable(z.string()).optional(), status: z.nullable(TimeOffRequestStatusStatus$outboundSchema).optional(), description: z.nullable(z.string()).optional(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), requestDate: z.nullable(z.string()).optional(), requestType: z.nullable(RequestType$outboundSchema).optional(), approvalDate: z.nullable(z.string()).optional(), units: z.nullable(Units$outboundSchema).optional(), amount: z.nullable(z.number()).optional(), dayPart: z.nullable(z.string()).optional(), notes: z.lazy(() => Notes$outboundSchema).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), policyType: z.string().optional(), }).transform((v) => { return remap$(v, { employeeId: "employee_id", policyId: "policy_id", startDate: "start_date", endDate: "end_date", requestDate: "request_date", requestType: "request_type", approvalDate: "approval_date", dayPart: "day_part", passThrough: "pass_through", policyType: "policy_type", }); }) ); export function timeOffRequestInputToJSON( timeOffRequestInput: TimeOffRequestInput, ): string { return JSON.stringify( TimeOffRequestInput$outboundSchema.parse(timeOffRequestInput), ); }