/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { ScheduleLayerV2, ScheduleLayerV2$inboundSchema, ScheduleLayerV2$Outbound, ScheduleLayerV2$outboundSchema, } from "./schedulelayerv2.js"; import { ScheduleRotationHandoverV2, ScheduleRotationHandoverV2$inboundSchema, ScheduleRotationHandoverV2$Outbound, ScheduleRotationHandoverV2$outboundSchema, } from "./schedulerotationhandoverv2.js"; import { UserV1, UserV1$inboundSchema, UserV1$Outbound, UserV1$outboundSchema, } from "./userv1.js"; import { WeekdayIntervalV2, WeekdayIntervalV2$inboundSchema, WeekdayIntervalV2$Outbound, WeekdayIntervalV2$outboundSchema, } from "./weekdayintervalv2.js"; export type ScheduleRotationV2 = { /** * When this rotation config will be effective from */ effectiveFrom?: Date | undefined; /** * Defines the next moment we'll trigger a handover */ handoverStartAt: Date; /** * Defines the handover intervals for this rota, in order they should apply */ handovers: Array; /** * Unique internal ID of the rotation */ id: string; /** * Controls how many people are on-call concurrently */ layers: Array; /** * Human readable name synced from external provider */ name: string; users?: Array | undefined; workingInterval?: Array | undefined; }; /** @internal */ export const ScheduleRotationV2$inboundSchema: z.ZodType< ScheduleRotationV2, z.ZodTypeDef, unknown > = z.object({ effective_from: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), handover_start_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), handovers: z.array(ScheduleRotationHandoverV2$inboundSchema), id: z.string(), layers: z.array(ScheduleLayerV2$inboundSchema), name: z.string(), users: z.array(UserV1$inboundSchema).optional(), working_interval: z.array(WeekdayIntervalV2$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "effective_from": "effectiveFrom", "handover_start_at": "handoverStartAt", "working_interval": "workingInterval", }); }); /** @internal */ export type ScheduleRotationV2$Outbound = { effective_from?: string | undefined; handover_start_at: string; handovers: Array; id: string; layers: Array; name: string; users?: Array | undefined; working_interval?: Array | undefined; }; /** @internal */ export const ScheduleRotationV2$outboundSchema: z.ZodType< ScheduleRotationV2$Outbound, z.ZodTypeDef, ScheduleRotationV2 > = z.object({ effectiveFrom: z.date().transform(v => v.toISOString()).optional(), handoverStartAt: z.date().transform(v => v.toISOString()), handovers: z.array(ScheduleRotationHandoverV2$outboundSchema), id: z.string(), layers: z.array(ScheduleLayerV2$outboundSchema), name: z.string(), users: z.array(UserV1$outboundSchema).optional(), workingInterval: z.array(WeekdayIntervalV2$outboundSchema).optional(), }).transform((v) => { return remap$(v, { effectiveFrom: "effective_from", handoverStartAt: "handover_start_at", workingInterval: "working_interval", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ScheduleRotationV2$ { /** @deprecated use `ScheduleRotationV2$inboundSchema` instead. */ export const inboundSchema = ScheduleRotationV2$inboundSchema; /** @deprecated use `ScheduleRotationV2$outboundSchema` instead. */ export const outboundSchema = ScheduleRotationV2$outboundSchema; /** @deprecated use `ScheduleRotationV2$Outbound` instead. */ export type Outbound = ScheduleRotationV2$Outbound; }