/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomTask, CustomTask$inboundSchema } from "./customtask.js"; import { TaskStatus, TaskStatus$inboundSchema } from "./taskstatus.js"; import { TaskTypeCOMPLETECUSTOMOFFBOARDINGTASKS, TaskTypeCOMPLETECUSTOMOFFBOARDINGTASKS$inboundSchema, } from "./tasktypecompletecustomoffboardingtasks.js"; /** * If the task is disabled, the reason and date when it was disabled. */ export type CompleteOffboardingCustomTasksTaskSummaryDisabled = { date: Date; reason: string | null; }; /** * Task summary for completing all offboarding custom tasks. */ export type CompleteOffboardingCustomTasksTaskSummary = { taskType: TaskTypeCOMPLETECUSTOMOFFBOARDINGTASKS; /** * The status of a task. * * @remarks * - COMPLETE: The task has been completed. * - DUE_SOON: The task is due soon. * - OVERDUE: The task is overdue. * - NONE: The task is not assigned. */ status: TaskStatus; /** * The due date of the task. */ dueDate: Date | null; /** * The date the task was completed. */ completionDate: Date | null; /** * If the task is disabled, the reason and date when it was disabled. */ disabled: CompleteOffboardingCustomTasksTaskSummaryDisabled | null; /** * Incomplete custom tasks that are relevant given a person's requirements. */ incompleteCustomOffboardingTasks: Array; /** * Custom tasks that have been completed and are relevant given a person's current requirements. */ completedCustomOffboardingTasks: Array; }; /** @internal */ export const CompleteOffboardingCustomTasksTaskSummaryDisabled$inboundSchema: z.ZodType< CompleteOffboardingCustomTasksTaskSummaryDisabled, z.ZodTypeDef, unknown > = z.object({ date: z.string().datetime({ offset: true }).transform(v => new Date(v)), reason: z.nullable(z.string()), }); export function completeOffboardingCustomTasksTaskSummaryDisabledFromJSON( jsonString: string, ): SafeParseResult< CompleteOffboardingCustomTasksTaskSummaryDisabled, SDKValidationError > { return safeParse( jsonString, (x) => CompleteOffboardingCustomTasksTaskSummaryDisabled$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CompleteOffboardingCustomTasksTaskSummaryDisabled' from JSON`, ); } /** @internal */ export const CompleteOffboardingCustomTasksTaskSummary$inboundSchema: z.ZodType< CompleteOffboardingCustomTasksTaskSummary, z.ZodTypeDef, unknown > = z.object({ taskType: TaskTypeCOMPLETECUSTOMOFFBOARDINGTASKS$inboundSchema, status: TaskStatus$inboundSchema, dueDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), completionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), disabled: z.nullable( z.lazy(() => CompleteOffboardingCustomTasksTaskSummaryDisabled$inboundSchema ), ), incompleteCustomOffboardingTasks: z.array(CustomTask$inboundSchema), completedCustomOffboardingTasks: z.array(CustomTask$inboundSchema), }); export function completeOffboardingCustomTasksTaskSummaryFromJSON( jsonString: string, ): SafeParseResult< CompleteOffboardingCustomTasksTaskSummary, SDKValidationError > { return safeParse( jsonString, (x) => CompleteOffboardingCustomTasksTaskSummary$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CompleteOffboardingCustomTasksTaskSummary' from JSON`, ); }