/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type OddWeeks = { hoursMonday?: number | undefined; hoursTuesday?: number | undefined; hoursWednesday?: number | undefined; hoursThursday?: number | undefined; hoursFriday?: number | undefined; hoursSaturday?: number | undefined; hoursSunday?: number | undefined; }; export type EvenWeeks = { hoursMonday?: number | undefined; hoursTuesday?: number | undefined; hoursWednesday?: number | undefined; hoursThursday?: number | undefined; hoursFriday?: number | undefined; hoursSaturday?: number | undefined; hoursSunday?: number | undefined; }; export type WorkPattern = { oddWeeks?: OddWeeks | undefined; evenWeeks?: EvenWeeks | undefined; }; export type Schedule = { /** * A unique identifier for an object. */ id: string; /** * The start date, inclusive, of the schedule period. */ startDate: string; /** * The end date, inclusive, of the schedule period. */ endDate: string; workPattern: WorkPattern; }; /** @internal */ export const OddWeeks$inboundSchema: z.ZodType< OddWeeks, z.ZodTypeDef, unknown > = z.object({ hours_monday: z.number().optional(), hours_tuesday: z.number().optional(), hours_wednesday: z.number().optional(), hours_thursday: z.number().optional(), hours_friday: z.number().optional(), hours_saturday: z.number().optional(), hours_sunday: z.number().optional(), }).transform((v) => { return remap$(v, { "hours_monday": "hoursMonday", "hours_tuesday": "hoursTuesday", "hours_wednesday": "hoursWednesday", "hours_thursday": "hoursThursday", "hours_friday": "hoursFriday", "hours_saturday": "hoursSaturday", "hours_sunday": "hoursSunday", }); }); /** @internal */ export type OddWeeks$Outbound = { hours_monday?: number | undefined; hours_tuesday?: number | undefined; hours_wednesday?: number | undefined; hours_thursday?: number | undefined; hours_friday?: number | undefined; hours_saturday?: number | undefined; hours_sunday?: number | undefined; }; /** @internal */ export const OddWeeks$outboundSchema: z.ZodType< OddWeeks$Outbound, z.ZodTypeDef, OddWeeks > = z.object({ hoursMonday: z.number().optional(), hoursTuesday: z.number().optional(), hoursWednesday: z.number().optional(), hoursThursday: z.number().optional(), hoursFriday: z.number().optional(), hoursSaturday: z.number().optional(), hoursSunday: z.number().optional(), }).transform((v) => { return remap$(v, { hoursMonday: "hours_monday", hoursTuesday: "hours_tuesday", hoursWednesday: "hours_wednesday", hoursThursday: "hours_thursday", hoursFriday: "hours_friday", hoursSaturday: "hours_saturday", hoursSunday: "hours_sunday", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OddWeeks$ { /** @deprecated use `OddWeeks$inboundSchema` instead. */ export const inboundSchema = OddWeeks$inboundSchema; /** @deprecated use `OddWeeks$outboundSchema` instead. */ export const outboundSchema = OddWeeks$outboundSchema; /** @deprecated use `OddWeeks$Outbound` instead. */ export type Outbound = OddWeeks$Outbound; } export function oddWeeksToJSON(oddWeeks: OddWeeks): string { return JSON.stringify(OddWeeks$outboundSchema.parse(oddWeeks)); } export function oddWeeksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OddWeeks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OddWeeks' from JSON`, ); } /** @internal */ export const EvenWeeks$inboundSchema: z.ZodType< EvenWeeks, z.ZodTypeDef, unknown > = z.object({ hours_monday: z.number().optional(), hours_tuesday: z.number().optional(), hours_wednesday: z.number().optional(), hours_thursday: z.number().optional(), hours_friday: z.number().optional(), hours_saturday: z.number().optional(), hours_sunday: z.number().optional(), }).transform((v) => { return remap$(v, { "hours_monday": "hoursMonday", "hours_tuesday": "hoursTuesday", "hours_wednesday": "hoursWednesday", "hours_thursday": "hoursThursday", "hours_friday": "hoursFriday", "hours_saturday": "hoursSaturday", "hours_sunday": "hoursSunday", }); }); /** @internal */ export type EvenWeeks$Outbound = { hours_monday?: number | undefined; hours_tuesday?: number | undefined; hours_wednesday?: number | undefined; hours_thursday?: number | undefined; hours_friday?: number | undefined; hours_saturday?: number | undefined; hours_sunday?: number | undefined; }; /** @internal */ export const EvenWeeks$outboundSchema: z.ZodType< EvenWeeks$Outbound, z.ZodTypeDef, EvenWeeks > = z.object({ hoursMonday: z.number().optional(), hoursTuesday: z.number().optional(), hoursWednesday: z.number().optional(), hoursThursday: z.number().optional(), hoursFriday: z.number().optional(), hoursSaturday: z.number().optional(), hoursSunday: z.number().optional(), }).transform((v) => { return remap$(v, { hoursMonday: "hours_monday", hoursTuesday: "hours_tuesday", hoursWednesday: "hours_wednesday", hoursThursday: "hours_thursday", hoursFriday: "hours_friday", hoursSaturday: "hours_saturday", hoursSunday: "hours_sunday", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace EvenWeeks$ { /** @deprecated use `EvenWeeks$inboundSchema` instead. */ export const inboundSchema = EvenWeeks$inboundSchema; /** @deprecated use `EvenWeeks$outboundSchema` instead. */ export const outboundSchema = EvenWeeks$outboundSchema; /** @deprecated use `EvenWeeks$Outbound` instead. */ export type Outbound = EvenWeeks$Outbound; } export function evenWeeksToJSON(evenWeeks: EvenWeeks): string { return JSON.stringify(EvenWeeks$outboundSchema.parse(evenWeeks)); } export function evenWeeksFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EvenWeeks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EvenWeeks' from JSON`, ); } /** @internal */ export const WorkPattern$inboundSchema: z.ZodType< WorkPattern, z.ZodTypeDef, unknown > = z.object({ odd_weeks: z.lazy(() => OddWeeks$inboundSchema).optional(), even_weeks: z.lazy(() => EvenWeeks$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "odd_weeks": "oddWeeks", "even_weeks": "evenWeeks", }); }); /** @internal */ export type WorkPattern$Outbound = { odd_weeks?: OddWeeks$Outbound | undefined; even_weeks?: EvenWeeks$Outbound | undefined; }; /** @internal */ export const WorkPattern$outboundSchema: z.ZodType< WorkPattern$Outbound, z.ZodTypeDef, WorkPattern > = z.object({ oddWeeks: z.lazy(() => OddWeeks$outboundSchema).optional(), evenWeeks: z.lazy(() => EvenWeeks$outboundSchema).optional(), }).transform((v) => { return remap$(v, { oddWeeks: "odd_weeks", evenWeeks: "even_weeks", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WorkPattern$ { /** @deprecated use `WorkPattern$inboundSchema` instead. */ export const inboundSchema = WorkPattern$inboundSchema; /** @deprecated use `WorkPattern$outboundSchema` instead. */ export const outboundSchema = WorkPattern$outboundSchema; /** @deprecated use `WorkPattern$Outbound` instead. */ export type Outbound = WorkPattern$Outbound; } export function workPatternToJSON(workPattern: WorkPattern): string { return JSON.stringify(WorkPattern$outboundSchema.parse(workPattern)); } export function workPatternFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkPattern$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkPattern' from JSON`, ); } /** @internal */ export const Schedule$inboundSchema: z.ZodType< Schedule, z.ZodTypeDef, unknown > = z.object({ id: z.string(), start_date: z.string(), end_date: z.string(), work_pattern: z.lazy(() => WorkPattern$inboundSchema), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "work_pattern": "workPattern", }); }); /** @internal */ export type Schedule$Outbound = { id: string; start_date: string; end_date: string; work_pattern: WorkPattern$Outbound; }; /** @internal */ export const Schedule$outboundSchema: z.ZodType< Schedule$Outbound, z.ZodTypeDef, Schedule > = z.object({ id: z.string(), startDate: z.string(), endDate: z.string(), workPattern: z.lazy(() => WorkPattern$outboundSchema), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", workPattern: "work_pattern", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Schedule$ { /** @deprecated use `Schedule$inboundSchema` instead. */ export const inboundSchema = Schedule$inboundSchema; /** @deprecated use `Schedule$outboundSchema` instead. */ export const outboundSchema = Schedule$outboundSchema; /** @deprecated use `Schedule$Outbound` instead. */ export type Outbound = Schedule$Outbound; } export function scheduleToJSON(schedule: Schedule): string { return JSON.stringify(Schedule$outboundSchema.parse(schedule)); } export function scheduleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Schedule$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Schedule' from JSON`, ); }